Use arguments in winmain

Mar 24, 2017 at 10:52pm
Hello i did one small console application for example
1
2
3
4
5
6
7
8
9
10
11
12
int argc, wchar_t* argv[]{
assert(argc > 1);

	// build command line

	wchar_t commandLine[MAX_PATH * 2];
	::lstrcpyW(commandLine, argv[1]);
	if (argc > 2) {
		::lstrcatW(commandLine, L" ");
		::lstrcatW(commandLine, argv[2]);
	}
}


But now i want to use winmain.. like..
1
2
3
4
5
6
7
8
9
10
int WINAPI WinMain(HINSTANCE hInstance, 
                   HINSTANCE hPrevInstance,
                   LPSTR lpszCmdParam, 
                   int nCmdShow)
{
   // Declaración:
   // Inicialización:
   // Bucle de mensajes:
   return Message.wParam;
}


How i can read these arguments again? argc and argv. Searching i found that the only way possible is using getcommandline
Last edited on Mar 25, 2017 at 12:11am
Mar 25, 2017 at 7:55am
Topic archived. No new replies allowed.