VB Command$ for VC++/MFC?

Echo15
08-14-2002, 07:34 PM
Hi!

Does anyone know if there is a VC++/MFC function similar to the VB command$ function?

We are trying to create a program using VC++ with MFC but we need to determine command line arguments used when the executable was launched.

Is this possible or is this restricted to VB only?

Thanks!!!

Flyguy
08-15-2002, 12:50 AM
These are the parameters passed to argv and argc in the main subroutine.

DrunkenHyena
08-15-2002, 03:24 AM
G'day!

Though if you're using MFC, then your entry point is likely WinMain, so you don't get argc/argv directly. WinMain is defined as follows:
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
);

And the docs have this to say about lpCmdLine:
Pointer to a null-terminated string specifying the command line for the application, excluding the program name. To retrieve the entire command line, use theGetCommandLine function

So in general, you can just use lpCmdLine.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum