For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > parsing command line args in CDialog app









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author parsing command line args in CDialog app
iceColdFire

2005-06-02, 9:06 am

Hi,
I have a CDIalog MFC based win ap under MSVC 6.0

Now I need to configure it for parsing command line parameters ,,,,
where and which function does accept argc, char** argv as there is no
main()

Kindly help

Thanks,
a.a.cpp

Jeff Partch [MVP]

2005-06-02, 9:06 am

"iceColdFire" <icoldfire@yahoo.com> wrote in message
news:1117697697.874470.34650@g47g2000cwa.googlegroups.com...
> Hi,
> I have a CDIalog MFC based win ap under MSVC 6.0
>
> Now I need to configure it for parsing command line parameters ,,,,
> where and which function does accept argc, char** argv as there is no
> main()


http://www.microsoft.com/msj/1099/c/c1099.aspx
--
Jeff Partch [VC++ MVP]


thatsalok

2005-06-02, 9:06 am

two option:

Either call API [GetCommandLine] or

call global variable

AfxGetApp()->m_lpCmdLine


--
cheers,
Alok Gupta
Visit me at http://alok.bizhat.com

"iceColdFire" <icoldfire@yahoo.com> wrote in message
news:1117697697.874470.34650@g47g2000cwa.googlegroups.com...
> Hi,
> I have a CDIalog MFC based win ap under MSVC 6.0
>
> Now I need to configure it for parsing command line parameters ,,,,
> where and which function does accept argc, char** argv as there is no
> main()
>
> Kindly help
>
> Thanks,
> a.a.cpp
>



Arman Sahakyan

2005-06-02, 9:06 am

Hi
Use CCommandLineInfo class, CWinApp::ParseCommandLine method.
The latter calls
CCommandLineInfo::ParseParam( LPCTSTR lpszParam, BOOL bFlag, BOOL bLast ).
Considering bFlag value, it defines if lpszParam is a parameter or flag.

Derive a class from CCommandLineInfo, override ParseParam method
and place the necessary code in it.


--
======
Arman
Nishant Sivakumar

2005-06-02, 9:06 am

You've seen the other answers - here's another way to do it

for(int i=0; i<__argc; i++)
MessageBox(__argv[i]);

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com
http://blog.voidnish.com


"iceColdFire" <icoldfire@yahoo.com> wrote in message
news:1117697697.874470.34650@g47g2000cwa.googlegroups.com...
> Hi,
> I have a CDIalog MFC based win ap under MSVC 6.0
>
> Now I need to configure it for parsing command line parameters ,,,,
> where and which function does accept argc, char** argv as there is no
> main()
>
> Kindly help
>
> Thanks,
> a.a.cpp
>




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com