BLI@fek.su.se (Bengt Lindstr|m) (11/07/90)
We are developing a communications program for windows 3.0 and needs to know our programs pathname at runtime. We have tried to find it in the environment, but twe only found the kernel's pathname there. Does anyone know how to get it?
hans@joker.mil.ufl.edu (Hans van Oostrom) (11/08/90)
In article <0A541F131D9F40032C@njord.fek.su.se> BLI@fek.su.se (Bengt Lindstr|m) writes: >We are developing a communications program for windows 3.0 and needs to >know our programs pathname at runtime. We have tried to find it in the >environment, but twe only found the kernel's pathname there. Does anyone >know how to get it? There is as you probably know the variable __argv available, which is the processed commandline. Standard C provides the program name as argv[0]. The fact that in a windows program argv[0] contains kern286.exe or equal should be concidered to be a bug. Since this all is parsed by windows before you can get your hands on it, it will be very difficult to get the program name. By the way the variable __argv is only spelled correctly (two __ ) on page 2-16 of the guide to programming, all other references are spelled as _argv, which of cource doesn't work. Hans van Oostrom hans@joker.mil.ufl.edu
rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (11/08/90)
In article <0A541F131D9F40032C@njord.fek.su.se> BLI@fek.su.se (Bengt Lindstr|m) writes: >We are developing a communications program for windows 3.0 and needs to >know our programs pathname at runtime. We have tried to find it in the >environment, but twe only found the kernel's pathname there. Does anyone Use GetModuleName() on your hInstance to get the full path name of your program. I hope GetModuleName() is the correct name, I don't have the refman here but I already used this function some time ago. Kai Uwe Rommel -- /* Kai Uwe Rommel * Munich * rommel@lan.informatik.tu-muenchen.dbp.de */
mojo@netcom.UUCP (Morris Jones) (11/09/90)
rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) writes: >Use GetModuleName() on your hInstance to get the full path name of your >program. I hope GetModuleName() is the correct name, I don't have the >refman here but I already used this function some time ago. According to QuickHelp, it's GetModuleFileName() ... good reference! I didn't know about this one. Mojo -- mojo@netcom.UUCP Site Coordinating Instructor, San Jose South Morris "Mojo" Jones Skilled Motorcycling And Rider Training (S.M.A.R.T.) Campbell, CA 800-675-5559 ... 800-CC-RIDER
chrisg@microsoft.UUCP (Chris GUZAK) (11/10/90)
In article <0A541F131D9F40032C@njord.fek.su.se> BLI@fek.su.se (Bengt Lindstr|m) writes: >.. needs to >know our programs pathname at runtime. GetModuleFileName() will do the trick. You may have to GetModuleHandle() on yourself, or perhaps you can pass your hInst as well... (david?) Chris Guzak