Visual Basic/VB >> hwnd for Msgbox?

by Harold » Wed, 08 Oct 2003 04:35:43 GMT

How do you find the hwnd for a message box that is created when an execption
occurs?

I need to find the hwnd of the msgbox, becasue I want to use the
SetForegroundWindow function to make it the active window.

Looking for help on where to start of find the hwnd of the msgbox.

Thanks
Harold




Visual Basic/VB >> hwnd for Msgbox?

by Rick Mogstad » Wed, 08 Oct 2003 05:08:06 GMT


You do reallize that when a messagebox is displayed, your code doesnt continue to execute until
the box is closed?








Visual Basic/VB >> hwnd for Msgbox?

by Jeff Johnson [MVP: VB] » Wed, 08 Oct 2003 05:10:14 GMT





execption

A message box is not created unless YOU create it. Or do you mean an
unhandled exception? In that case, VB takes over and your code isn't running
anymore, so you can't do what you're trying to do.




hwnd for Msgbox?

by Paul Overway » Wed, 08 Oct 2003 05:14:57 GMT

Why wouldn't you just use vbSystemModal as parameter?




execption




hwnd for Msgbox?

by Harold » Wed, 08 Oct 2003 05:33:27 GMT

Currently I am using the "vbMsgBoxSetForeground" parameter to bring the
msgbox forward.

But as I understand it Even a Msgbox is a window, and all windows have
handles.

The problem behind this is that my Vb Application opens an DB Application, I
have Views in the DbAPP that open to show some data. Occasionally When
someone else is already in it or has it open the DB Application will open
buy no view opens because it will not allow to view on the same DB Module.
But because the DB App opens on top of my VB App it hides the Msgbox that
tells the user that the view cannot open. I am currently using the
"vbMsgBoxSetForeground" parameter in the Msgbox to bring it forward. I am
trying to learn how to use API calls and I wanted to use the
SetForegroundWindow function to make it the active window, but I need the
hwnd for the msgbox to use this call..

Harold




execption




hwnd for Msgbox?

by Karl E. Peterson » Wed, 08 Oct 2003 05:34:15 GMT




Not really. If you have a timer running, it'll continue firing events in an EXE.
(Hint, hint <g>)

Later... Karl
--
[Microsoft Basic: 1976-2001, RIP]




hwnd for Msgbox?

by Rick Mogstad » Wed, 08 Oct 2003 05:45:23 GMT

Yeah, true. Ive done this myself before.








hwnd for Msgbox?

by Karl E. Peterson » Wed, 08 Oct 2003 06:38:03 GMT

Hi Harold --


Well, I'm confused on "who" exactly is popping the message, but if it's you, one of
my samples may help you see how to find its hwnd. See MovedMsg.zip and/or
TimedMsg.zip on http://www.mvps.org/vb/samples.htm for ideas.

Later... Karl
--
[Microsoft Basic: 1976-2001, RIP]




Similar Threads

1. vb msgbox versus custom msgbox