Click here to Skip to main content
15,890,973 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionEscape out double quote Pin
jkirkerx23-Nov-11 10:12
professionaljkirkerx23-Nov-11 10:12 
AnswerRe: Escape out double quote Pin
Albert Holguin23-Nov-11 10:42
professionalAlbert Holguin23-Nov-11 10:42 
AnswerRe: Escape out double quote Pin
Graham Breach23-Nov-11 10:43
Graham Breach23-Nov-11 10:43 
GeneralRe: Escape out double quote Pin
jkirkerx23-Nov-11 11:07
professionaljkirkerx23-Nov-11 11:07 
QuestionReading Save File Problem Pin
idbee2k323-Nov-11 9:13
idbee2k323-Nov-11 9:13 
SuggestionRe: Reading Save File Problem Pin
Albert Holguin23-Nov-11 9:31
professionalAlbert Holguin23-Nov-11 9:31 
AnswerRe: Reading Save File Problem Pin
David Crow26-Nov-11 6:50
David Crow26-Nov-11 6:50 
QuestionUsing Main to grab command line arguments if it doesn't already exist? Pin
Lucidation23-Nov-11 6:15
Lucidation23-Nov-11 6:15 
First off, I'm not sure if I'm quite in the right forum or not, so just let me know if I should post elsehwere. With that said...

I'm brand new to C++ and am trying to wrap my brain around something. I know that I can use a MAIN function in a .CPP file and use it to grab command line arguments. I'm trying to add this feature to an existing clump of code we've got at work (I'm trying to expand my skills, and it's a small utility we techies use only occasionally). Anyway, I can't figure out how to use a MAIN function if there isn't already one (I can make it work in a brand new test project just fine). My current attempt to tweak the code sort of looks like this:

C++
#include "stdafx.h"
#include ...a few other files.....

class CApp : public CWinAppEx
{
public:
	CApp();
	public:
	virtual BOOL InitInstance();
};

extern CApp theApp;


int main(int argc, char *argv[])
{
	MessageBox(NULL, L"This should display first, but doesn't currently show up at all.", NULL, NULL);
}


// CApp construction
CApp::CApp()
{
	MessageBox(NULL, L"This should display second, but currently shows up first.", NULL, NULL);
}


// CApp object
CApp theApp;


// CApp initialization
BOOL CApp::InitInstance()
//int main(array<System::String ^> ^args)
{
	MessageBox(NULL, L"This should display third, but currently shows up second.", NULL, NULL);
	...does other stuff here...
}


So what do I need to do to use MAIN correctly to grab the command line arguments?

Thanks!
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Albert Holguin23-Nov-11 7:21
professionalAlbert Holguin23-Nov-11 7:21 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chris Meech23-Nov-11 7:22
Chris Meech23-Nov-11 7:22 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chuck O'Toole23-Nov-11 7:43
Chuck O'Toole23-Nov-11 7:43 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Software_Developer23-Nov-11 7:52
Software_Developer23-Nov-11 7:52 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chris Losinger23-Nov-11 8:41
professionalChris Losinger23-Nov-11 8:41 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chuck O'Toole23-Nov-11 9:36
Chuck O'Toole23-Nov-11 9:36 
QuestionBit Fielf In UML Pin
Member 842679823-Nov-11 0:29
Member 842679823-Nov-11 0:29 
AnswerRe: Bit Fielf In UML Pin
Software_Developer23-Nov-11 0:43
Software_Developer23-Nov-11 0:43 
GeneralRe: Bit Field In UML Pin
Member 842679823-Nov-11 1:13
Member 842679823-Nov-11 1:13 
GeneralRe: Bit Field In UML Pin
Software_Developer23-Nov-11 3:24
Software_Developer23-Nov-11 3:24 
GeneralRe: Bit Field In UML Pin
Member 842679824-Nov-11 7:05
Member 842679824-Nov-11 7:05 
GeneralRe: Bit Field In UML Pin
Member 842679825-Nov-11 21:23
Member 842679825-Nov-11 21:23 
QuestionDoesn't open heading file VC ++ Pin
PeLeg8922-Nov-11 23:55
PeLeg8922-Nov-11 23:55 
AnswerRe: Doesn't open heading file VC ++ Pin
Richard MacCutchan23-Nov-11 0:04
mveRichard MacCutchan23-Nov-11 0:04 
GeneralRe: Doesn't open heading file VC ++ Pin
PeLeg8923-Nov-11 0:14
PeLeg8923-Nov-11 0:14 
GeneralRe: Doesn't open heading file VC ++ Pin
Richard MacCutchan23-Nov-11 0:30
mveRichard MacCutchan23-Nov-11 0:30 
GeneralRe: Doesn't open heading file VC ++ Pin
Erudite_Eric23-Nov-11 1:24
Erudite_Eric23-Nov-11 1:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.