Re: OTOH, you folks are smart ...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Well, you could do a GetModuleHandle on your DLL name. AfxGetInstanceHandle is defined to
give you the instance handle of the executable image, not the current DLL.
joe

On Thu, 20 Sep 2007 10:29:13 -0500, "BobF" <rNfOrSePeAzMe@xxxxxxxxxxx> wrote:


"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:n135f3p6afsrvj8sftv5c4e8jpks1kstuf@xxxxxxxxxx
Why do you need AfxGetInstanceHandle? If you are in a DLL, you will get
the instance
handle to the DLL as the first parameter to DllMain, and you just save it.
joe

If I query for the DLL instance handle, I can get rid of the SDK DllMain and
let the default from the runtime suffice. Then I'll have the SDK in the
lib, thus satisfying my OCD tendencies. The *only* thing the SDK-provided
DllMain does is to save the instance handle.

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: How to get imagebase after a DLL gets loaded
    ... and William provided a sensible answer. ... assigned-to during DllMain PROCESS_ATTACH." ... The OP asked "how to get imagebase after a DLL gets loaded". ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How to get imagebase after a DLL gets loaded
    ... and William provided a sensible answer. ... assigned-to during DllMain PROCESS_ATTACH." ... The OP asked "how to get imagebase after a DLL gets loaded". ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How to get imagebase after a DLL gets loaded
    ... and William provided a sensible answer. ... assigned-to during DllMain PROCESS_ATTACH." ... The OP asked "how to get imagebase after a DLL gets loaded". ...
    (microsoft.public.win32.programmer.kernel)
  • Re: OTOH, you folks are smart ...
    ... for DllMain or any code to be executed before DoSomethingis called. ... to make a DLL ... I am the SDK user. ... *appears* to me to be because of the order the libraries get processed. ...
    (microsoft.public.vc.mfc)
  • Re: MTA with Thread Pool API
    ... I would definitely try to avoid calling any winuser functions ffrom DllMain ... Microsoft technical article says to do for proper connection pooling. ... The SDK is very clear that you must call the CoInit functions once per ... I thought about moving all the code into a DLL, ...
    (microsoft.public.win32.programmer.kernel)