c++ - MFC - extend app to run from command line -
i have existing mfc application i'm trying extend accept command line parameters , run unattended.
i need kick off events after initinstance() has finished , existing gui has been loaded. i've looked @ winmain.cpp, it's not clear me how run events seems kick off thread , 'disappear' debugger (i.e. gets executed next? must mfc loop, right? possible hook there?) i'm new , it's entirely possible i'm missing insight @ higher level, not googled. grateful pointers.
thanks.
i parse command line in initinstance
usual, instead of processing commands find, add special processing ones care (for example) post messages own message queue when you're ready start processing messages, they'll show first things do.
to that, i'd probably derive class ccomandlineinfo
, , override parseparam
handle commands care (and have send other arguments doesn't recognize ccomandlineinfo::parseparam
handled normally). then, in initinstance, replace bit of code:
// parse command line standard shell commands, dde, file open ccommandlineinfo cmdinfo; parsecommandline(cmdinfo);
with 1 using custom command line parser:
mycommandlineinfo cmdinfo; parsecommandline(cmdinfo);
parsecommandline
invoke parseparam
each parameter on command line, giving first chance @ deciding means , how process it. you'll want "standard" commands ccomandlineinfo
understands, , leave them alone unless really need change them.
Comments
Post a Comment