🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13405

Re: How can te program know it's file name

#13405
From: Bob Gonder
Date: Wed, 15 Oct 2003 19:25
16 lines
1607 bytes
Emmanuel wrote:

>char c[51];
>GetModuleFileName(NULL,c,50)
>
>It just return "C:\WINNT\System32\dllhost.exe"

Well, yeah....from help...
"If this parameter is NULL, GetModuleFileName returns the path for the
file used to create the calling process."

So, dllhost is the file that _created_ the calling process.
IOW, NULL asks "Who made me" not "Who am I".

What you seem to want is the name of the file of the calling process,
so you should pass the handle of the calling process instead of NULL.
Technical Details
Message-ID: <ng7rovgvq1f1a1pbshjjmo80vflhiov2bc@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!kibo.news.demon.net!demon!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f8d7b5e$2@newsgroups.borland.com> <3f8d7d0b@newsgroups.borland.com> <3f8d94ec@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,c6451c230ee766d8
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-15 12:40:33 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: How can te program know it's file name
Date: Wed, 15 Oct 2003 12:25:47 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <ng7rovgvq1f1a1pbshjjmo80vflhiov2bc@4ax.com>
References: <3f8d7b5e$2@newsgroups.borland.com> <3f8d7d0b@newsgroups.borland.com> <3f8d94ec@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.165.20
X-Trace: newsgroups.borland.com 1066245948 67.31.165.20 (15 Oct 2003 12:25:48 -0700)
Lines: 19
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!kibo.news.demon.net!demon!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail