Archived

This topic is now archived and is closed to further replies.

Win32

This topic is 6385 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
"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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites