How to have the ability to execute like game.exe -easy?
Hi. I am using win32 application to build using vc++ 6.0.I want to have my game to have multiple level of difficulties, and i want to run it using batch file like
game -easy
game -normal
game -hard
How can i achieve that?
Thanks in advance
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
);
lpCmdLine contains the command line excluding the program name
Ex:
c:\game test
lpCmdLine contains test
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
);
lpCmdLine contains the command line excluding the program name
Ex:
c:\game test
lpCmdLine contains test
Actually, in that example, I believe lpCmdLine contains "game.exe test". But all you have to do is MessageBox( NULL, lpCmdLine, NULL, MB_OK ); and find out for yourself.
Then you just parse it. I wrote a simple string parser that converts it into int argc and char** argv like in a DOS (or Console) program. It''s really pretty easy, since you know all words are seperated by one space. No tabs or multiple spaces or anything.
~CGameProgrammer( );
Then you just parse it. I wrote a simple string parser that converts it into int argc and char** argv like in a DOS (or Console) program. It''s really pretty easy, since you know all words are seperated by one space. No tabs or multiple spaces or anything.
~CGameProgrammer( );
quote:
I wrote a simple string parser that converts it into int argc and char** argv like in a DOS (or Console) program.
Try CommandLineToArgvW() instead (note that it''s Unicode).
"If people are good only because they fear punishment and hope for reward, then we are a sorry lot indeed." - Albert Einstein
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement