Hey, I am reading tricks of the windows game programming gurus: (Lamothe)
I am a little confused. it says that the LPSTR lpcmdline of the winmain function will = "one two three" if the user types Test.exe one. how is that? It goes on to say that .exe is not part of the command line. Also could someone explain this WINAPI thing that goes before WinMain a little better? it looks like this: int WINAPI WinMain(...). How can you have two return types? THis is not C/C++!
Temer
"WINAPI" is just a function modifier. i don''t remember what it is exactly, but it might equate to "__far __pascal" something.
lpCmdLine is the string of arguments passed to the WinMain function. the executable name is not part of that.
crazy166
some people think i'm crazy, some people know it
lpCmdLine is the string of arguments passed to the WinMain function. the executable name is not part of that.
crazy166
some people think i'm crazy, some people know it
Hi all.
I just wanted to add to what crazy said that you get a pointer to the arguments passed to your application, that if you for some weird reason need to know the name of the executable, you can use an WIN32 API function available for that (GetModuleName?).
Topgoro
I just wanted to add to what crazy said that you get a pointer to the arguments passed to your application, that if you for some weird reason need to know the name of the executable, you can use an WIN32 API function available for that (GetModuleName?).
Topgoro
We emphasize "gotoless" programming in this company, so constructs like "goto hell" are strictly forbidden.
WINAPI is defined as __stdcall which means that the parameters are pushed onto the stack from right to left, it also means some other stuff... look up help on Calling Conventions then look for __stdcall it will tell you more than you probably care to know about it.
ao
ao
Play free Java games at: www.infinitepixels.com
LPSTR lpcmdline
this is a string argument you are given when you create the WinMain function. What it is, is the text typed after your compiled .exe program if you were to run it from the command line. For example, if were to go to open a command prompt from windows and type this:
myprogram.exe /P /E -f
Then the lpcmdline string would equal "/P /E -f", you would have to then have a string analyzing function to decipher your command line string into something you could use. This way, you can write programs that opperate differently by what command line options you give them. For example:
If you were to run the Tomb Raider 3 executable (TR3.EXE) normaly, it would simply run the game as you would expect.
However, if you were to run it like this: TR3 -setup
The same executable now runs a setup program where you can set the graphics and sound options for the game.
this is a string argument you are given when you create the WinMain function. What it is, is the text typed after your compiled .exe program if you were to run it from the command line. For example, if were to go to open a command prompt from windows and type this:
myprogram.exe /P /E -f
Then the lpcmdline string would equal "/P /E -f", you would have to then have a string analyzing function to decipher your command line string into something you could use. This way, you can write programs that opperate differently by what command line options you give them. For example:
If you were to run the Tomb Raider 3 executable (TR3.EXE) normaly, it would simply run the game as you would expect.
However, if you were to run it like this: TR3 -setup
The same executable now runs a setup program where you can set the graphics and sound options for the game.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement