Article View: borland.public.cppbuilder.nativeapi
Article #13319Re: How can te program know it's file name
From: Ed Mulroy [TeamB]
Date: Wed, 15 Oct 2003 22:48
Date: Wed, 15 Oct 2003 22:48
24 lines
1822 bytes
1822 bytes
Your source code should have one of a DllMain or DllEntryPoint function. The module handle is specified as a calling argument to those functions. If you do not have access to the source files for that part of your DLL then I think you can still get it because of a variable created by the compiler's startup code. Add this declaration to tell the compiler about the existance of the variable. extern HINSTANCE _hInstance; And then get the DLL's file name with code like this: char dll_name[MAX_PATH + 1]; GetModuleHandle((HMODULE) _hInstance, dll_name, sizeof(dll_name)); . Ed > Emmanuel wrote in message > news:3f8dad66@newsgroups.borland.com... > > So, how can I get the DLL's actual HMODULE handle?
Technical Details
Message-ID:
<3f8dcedf@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f8d7b5e$2@newsgroups.borland.com> <3f8d7d0b@newsgroups.borland.com> <3f8d94ec@newsgroups.borland.com> <3f8da65a$1@newsgroups.borland.com> <3f8dad66@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 16:09:22 PST From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f8d7b5e$2@newsgroups.borland.com> <3f8d7d0b@newsgroups.borland.com> <3f8d94ec@newsgroups.borland.com> <3f8da65a$1@newsgroups.borland.com> <3f8dad66@newsgroups.borland.com> Subject: Re: How can te program know it's file name Date: Wed, 15 Oct 2003 18:48:46 -0400 Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 24.74.175.102 Message-ID: <3f8dcedf@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1066258143 24.74.175.102 (15 Oct 2003 15:49:03 -0700) X-Authenticated-User: edmulroy Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail