PDA

You are currently viewing a search engine-friendly (archive) version of this page.

View Full Version : Is there an alternative to argv[0]?


Mr_i
January 7, 2002, 04:25 pm
Im trying to get the filename of my exectuable, but im using WinMain, so i cant use argv[]. Are there any alternatives that will give me my filename?

thanks.

Tonker
January 8, 2002, 05:37 pm
Welcome to the board Mr_i! :)

See if this is of any help:
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/windows_64ku.asp" target="_blank">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/windows_64ku.asp </a>

In particular the part about: LPSTR lpszCmdParam. I would guess that is where you would find it. I've never used winmain, though.

<a href="http://www.gameprogrammer.com/archive/html/msg04756.html" target="_blank">Another link</a> talking about lpszCmdParam. I would guess that you use a string tokenizing function (such as strtok() ).

[ January 09, 2002: Message edited by: Tonker ]</p>

Tonker
January 9, 2002, 09:48 am
Hmm, sorry the code I was going to post here was no good. :(

Try this <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/prothred_0mzp.asp" target="_blank">MS link</a>, though and check out the link from there to GetCommandLineW.

[ January 09, 2002: Message edited by: Tonker ]</p>

r_ay
January 10, 2002, 09:37 am
Check the documentation on "_pgmptr". I think this is what you're looking for.

Tonker
January 10, 2002, 10:00 am
Welcome to HFT r_ay! <img src="graemlins/jump.gif" border="0" alt="[Jumping]" />

Glad to see somebody can point Mr_i in the right direction. :)

Mr_i
January 10, 2002, 07:47 pm
r_ay, I LOVE YOU!!!!

thanks mate.

tweakthis
January 10, 2002, 08:31 pm
Woo hoo, welcome to helpfromtechs, r_ay! I love it when a new member starts out with a winner....heck, I love it when there's a new member. :D :D <img src="graemlins/jump.gif" border="0" alt="[Jumping]" />

Hey, bro, how's it going? ;) Psssttt, did you know that a certain girl has a birthday coming up soon. ;) *lol* :D :D

[ January 10, 2002: Message edited by: tweakthis ]</p>