Apr 16, 2015 at 9:17pm
I am new to Visual studio C++. I am working on a project where I need to use the parameter passed into via lpCmdline. Thank you
Apr 17, 2015 at 2:59pm
1 2 3 4 5 6 7
|
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
MessageBox(0,lpCmdLine,"Command Line",MB_OK);
return 0;
}
|
You can either call from command line or drag a file on top of compiled exe.
If you need to access the command line outside of WinMain, you call GetCommandLine(), but I think that returns a TCHAR string, not a c-style string.
Last edited on Apr 17, 2015 at 3:00pm