Hi,
I've followed simple steps ie: Created a class (call it mycommandline)
inheriting from CCommandLineInfo. Than overrided the ParseParam
method. Created a mycommandline object and passed to ParseCommandLine
method of my CWinApp inside its InitInstance method. Now I pass
command line arguments to my application but my overrided ParseParam
is not getting called. What am I doing wrong?
command line class code that I wrote is:
class mycommandline: public CCommandLineInfo
{
public:
mycommandline();
virtual void ParseParam(const char* pszParam, BOOL bFlag, BOOL
bLast );
};
mycommandline::mycommandline()
{}
void mycommandline::ParseParam(const char* pszParam, BOOL bFlag, BOOL
bLast )
{
::MessageBoxA(NULL, pszParam, "args", MB_OK);
}
Regards,
..ab
Ben Voigt [C++ MVP] - 11 Jun 2007 18:02 GMT
> Hi,
> I've followed simple steps ie: Created a class (call it mycommandline)
[quoted text clipped - 11 lines]
> virtual void ParseParam(const char* pszParam, BOOL bFlag, BOOL
> bLast );
With VC++ 2005, you can put "override" on the end of that line, same place
const would go, and the compiler will tell you if it would shadow instead of
overriding. This was added for .NET, but works in native (like MFC)
programs as well.
> };
> mycommandline::mycommandline()
[quoted text clipped - 9 lines]
>
> ..ab