I am trying to access the data lpCmdline

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
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
Topic archived. No new replies allowed.