|
-
Oct 9th, 2001, 01:43 PM
#1
Thread Starter
New Member
Overloading WinMain while using MFC
The program I am trying to write will be started twice, the first time with a "-R", the next without. In WinMain, I need to trap the "registration" call to the program, and exit with a Task Id.
I have created the project with the MFC App Wizard, so how would I now override the WinMain function to test the Command Line Parameters?
All help appreciated.
Thanks
I'm going bald ...
Its self-inflicted ...
I'm tearing my hair out!!!!
-
Oct 10th, 2001, 02:57 PM
#2
You can't override a already defined function.
I'd say put your stuff in CMyApp::InitInstance() and exit after you processed it - this way, no window is created.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 11th, 2001, 12:15 PM
#3
Thread Starter
New Member
Thanks for that. Unfortunately, the Framework doesn't seem to pass the commandline argument out of WinMain, and I need to parse that to determine which action to take.
If the project wasn't using the communal WinMain I would edit the existing routine to add the additional code.
Development has not progressed so far that I couldn't scrap what I have done and start again, but my experience with VC++ goes as far as the App Wizards and the Class Wizard - hence the reason I started with the MFC App Wizard Exe. If you could offer any further suggestions they woud be most appreciated.
Thanks,
Nick
I'm going bald ...
Its self-inflicted ...
I'm tearing my hair out!!!!
-
Oct 11th, 2001, 01:38 PM
#4
Your CWinApp object (the class of which InitInstance is a member) has a member named m_lpCommandLine. This is the command line.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|