Hello All!
I've been playing around with OpenGL and the windows API, but came across a little problem. I've seen people talking about how to implement Argv-type functions into their WinMain method using CommandLineToArgvW(). I've attempted to do this, and use some clever code mechanics to adjust the height of the window based on the parameters, but for some reason, even though my code compiles, it ignores the flags and gives it the default window size. I've had no idea how to correct it as I'm new to the WindowsAPI.
Code:
Thank You All!
I've been playing around with OpenGL and the windows API, but came across a little problem. I've seen people talking about how to implement Argv-type functions into their WinMain method using CommandLineToArgvW(). I've attempted to do this, and use some clever code mechanics to adjust the height of the window based on the parameters, but for some reason, even though my code compiles, it ignores the flags and gives it the default window size. I've had no idea how to correct it as I'm new to the WindowsAPI.
Code:
LPWSTR *szArgList; int argCount; szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount); for(int i = 1;i < argCount;i++) { if(i + 1 != argCount) { if(szArgList[i] == L"-w") { width = _wtoi(szArgList[i+1]); } else if(szArgList[i] == L"-h") { height = _wtoi(szArgList[i+1]); } } } MSG msg; BOOL done=FALSE; if(MessageBox(NULL,"Fullscreen?", "my window", MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; } if(!CreateGLWindow("Window",width,height,16,fullscreen)) { return 0; }
Thank You All!