LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

get a popup-dialog window handle?

Hello all,

is it possible to get a window handle from a popup dialog (created with int err = MessagePopup("title", "text");) so that i can close such popups without user interaction?

I have a application which makes a kind of a replay of former user actions, and I have to react on unexpected message popups (e.g. close popup without using the mouse and so on)

Is there another way to manipulate this popups?

Thanks a lot,
Bern
0 Kudos
Message 1 of 4
(3,979 Views)
Bern,

The Message Popup windows are generated by the operating system when CVI calls any of the popup functions. CVI does not have much control over the appearance or configuration. There are 2 ways to get around this:

1.- Use a CVI panel as a message popup. You can create a function where you create the panel with the message and wait for the user to click the ok option. I am including a small example on how to do this. the advantage here is that you have a CVI panel, so you can change attributes just like you do to any CVI panel.

2.- Get a handle to the actual Window and use Windows SDK functions to close it. Since the message popup windows are not native CVI panels, you can't get a panel handle. However since the message popup is a window, you can
use the Windows SDK function FindWindow to get a handle to the message window. Once you have a handle you can use the windows SDK functions to manage the window.

Please take a look at this example and let me know if you have any questions on this.

Regards,

Juan Carlos
N.I.
Message 2 of 4
(3,979 Views)
Hello Juan,

thanks for your help! I've choosen the first option because it is more flexible to work with real panels for my project. It would have been nice to get a handle from the MessagePopup to save some coding time because now I have to recode all the popup mechanism in the existing application.
The FindWindow function is also not suitable for me because there are sometimes more than one popup windows (same class, same windowname) which unfortunately may need different action.

Thank you and have a nice time!
Bern
0 Kudos
Message 3 of 4
(3,979 Views)
Bern,

I'm glad this was useful, the CVI panels will definatelly give you much more control. You can still use the MessagePopup whenever you need some sort of dialog to report an error.

Have a good weekend.

Juan Carlos
0 Kudos
Message 4 of 4
(3,979 Views)