Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!eng.ufl.edu!joker.mil.ufl.edu!hans From: hans@joker.mil.ufl.edu (Hans van Oostrom) Newsgroups: comp.windows.ms.programmer Subject: Re: pathname Message-ID: <1990Nov7.222609.11647@eng.ufl.edu> Date: 7 Nov 90 22:26:09 GMT References: <0A541F131D9F40032C@njord.fek.su.se> Sender: news@eng.ufl.edu Organization: Machine Intelligence Lab, University of Florida Lines: 19 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