LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you make an ActiveX server VI the active window?

I am working with LabView 5.1 and Windows (NT and 2000). My VI is
compiled as an ActiveX server, and I am successfully calling it.
However, there does not appear to be any LabView method for traversing
the VI's menus, so I have to send keystrokes (via the Windows
Scripting Host) to do that. Windows Scripting Host will only send
keystrokes to the currently active window - so if the VI has been
minimized, I must first make it active. How do I do that?

If I have Notepad running but minimized, I can make it the active
window and send it keystrokes like this:

$WShell AppActivate "Untitled - Notepad" ; Activates but stays
iconized
(wait one second)
$WShell SendKeys "% r" ; Restores (open
s) the
window
(wait one second)
$WShell SendKeys "Hello World"

but this doesn't work with my VI. The VI window appears, but the
menu-activation keystrokes don't do anything. They worked just after
the VI was started (before it was minimized). How do I correctly
re-activate the VI so I can send it keystrokes?

TIA.

Leslie
0 Kudos
Message 1 of 3
(2,772 Views)
Before continuing on this thread, can you tell which VI menu you are trying to trigger? Many menu functions are also available programmatically so there might be a less involved way to achieve your goal...

Jean-Pierre Drolet


LabVIEW, C'est LabVIEW

0 Kudos
Message 2 of 3
(2,772 Views)
you might wana try Windows API functions to activate or maximize the VI window. Here is the link to labview VIs that lets you call WinAPI functions.

ftp://ftp.ni.com/support/labview/vis/windows/4.0/lvwutil32/

BTW does the window even activate when you try to execute the script host method? Try changing window title to less than 8 characters without spaces....(just a shot).

Hope this would help

A Rafiq
National Instruments
0 Kudos
Message 3 of 3
(2,772 Views)