Mailing List Archive

wheres the HINSTANCE
I am trying to extend PythonWin and need the applications HINSTANCE
(for example, the first argument passed to WinMain). Anyone know how
I can get it? In case it matters, I am writing the extension module
in C++.

gw.
wheres the HINSTANCE [ In reply to ]
In article <372b3dfd.517942@nntp.best.com>, gcw@best.com writes
>I am trying to extend PythonWin and need the applications HINSTANCE
>(for example, the first argument passed to WinMain). Anyone know how
>I can get it? In case it matters, I am writing the extension module
>in C++.
>
>gw.
>
you can use the EnumThreadWindows api call to get a list of the windows
associated with a particular thread. It seems difficult to find the main
window.
--
Robin Becker
wheres the HINSTANCE [ In reply to ]
This isnt directly available; however, I believe GetModuleHandle(NULL) will
return this information? In in almost all cases, you can pass NULL as the
HINSTANCE to refer to the current app. Indeed, most Pythonwin code can run
outside of Pythonwin.exe (eg, the Pythonwin debugger) so assuming the
particular host is not always a good idea.

win32ui and sys both have a "dllhandle" attribute - these are the HMODULEs
for their respective DLLs.

Why do you need to know?

Mark.

gcw@best.com wrote in message <372b3dfd.517942@nntp.best.com>...
>I am trying to extend PythonWin and need the applications HINSTANCE
>(for example, the first argument passed to WinMain). Anyone know how
>I can get it? In case it matters, I am writing the extension module
>in C++.