I need to know the HWND of the parent window of that program so that I can issue
an error message if one occurs.
How do I find the parent window handle?
maybe try GetCurrentThreadId & EnumThreadWindows?
I'm a bit surprised no one has answered already. I've never tried to
do such a thing, because I gather it is tricky and have managed to
avoid needing it. With a little work, I found a useful search string
for google (http://groups.google.com/advanced_group_search). I
hwnd from hinstance
(exact phrase) and got 16 hits. I took a look at the first few, and
think they will be useful, though probably not what you really want.
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
500 Harrison Ave., Suite 3R
Boston, MA 02118
>On Tue, 28 Dec 2004 18:11:30 GMT, Den...@NoSpam.com wrote:
>>I have a C++ DLL that is loaded by someone else's windows program.
>>I need to know the HWND of the parent window of that program so that I can issue
>>an error message if one occurs.
>>How do I find the parent window handle?
>I'm a bit surprised no one has answered already. I've never tried to
Oops. KaKeeware _had_ answered and I had read that post before I
replied. My memory slipped.
I tried a handle=0 and it worked.
The message function put the message on top of the parent window with the
required "ok" button.
I suspect you're passing 0 to MessageBox. If so, then you are
effectively saying the window created by the MessageBox function is a
child of the desktop. That means the window will always be on top of
everything. This _may_ be appropriate in some situations, but is
generally considered rude. In particular, error messages for one
application should not be on top of everything.