LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Activate Window not working in teststand

Hello,
I have two small test-Vis.
What they do is:
 
First VI:
a.) Starting notepad.exe
b.) get refnum of the notepad-window
c.) Make it topmost with the lvutil.llb
d.) Write a text in it with "keybd_event"
 
Second VI:
The Same like in 1.) but without starting notepad (the program is already open.
 
 
When i run this two VIs in labview one after another it works without problems.
When i run them as Actions in "NI Teststand" then it only works if i run both in "one run".
 
But if i cklick first the first vi and "run selected step" and then the second vi with "run selected step" then the second VI only brings the notepad-window to foreground but doesnt activate it. And without activation the text is not written in the notepad-window.
 
Is there any trick i can do to always activate the window?
Im uing Windows2000 /LV 7.1.1 / Teststand 3.1
 
Thx for any help.
 
0 Kudos
Message 1 of 7
(4,185 Views)

Try Set Active Window http://www.geocities.com/gzou999/demo.htm

 

George Zou

George Zou
0 Kudos
Message 2 of 7
(4,176 Views)
Hi Zou,
thx for your help. I downloaded the zip-file but after unpacking and opening the llb i get the error:

LabVIEW. resource nout found.
An error occured loading VI "Set Active Window"
Labview load error code 3: Could not load front panel
[OK]

(Meanwhile i´m using a workaround and call "SetForegroundWindow", this works in Labview AND Teststand)
0 Kudos
Message 3 of 7
(4,171 Views)
You don't need to open a subvi to run it, do you ?
Just FYI, you can open a blank vi, and put Set Active Window on the diagram.
 
George Zou
George Zou
0 Kudos
Message 4 of 7
(4,168 Views)
Hi zou,
thx for your Vi.
I saw on your page the user´s guide. There is something written about "Key Down.vi / Key up.vi" Are these two VIs also somewhere to download?
How did you do this, that the keystrokes go directly to the window specified by the handle and not just to the currently active window (like i do it)?
Thx fo any tipp
0 Kudos
Message 5 of 7
(4,161 Views)
Given window handle, you can always make it active window, rigtht ?
This method works only for active window, just like you use keyboad.
That's by design.
 
If you want to send a string to a text box, you might be able to use WM_SETTEXT.
 
 
George Zou
George Zou
0 Kudos
Message 6 of 7
(4,157 Views)

Hello,

 

I just started working with LabView/TestStand and got a similar Problem.

 

I want to activate a certain window (extern executable) and control it by simulating keystrokes.

I am using the attached VI and implement it as an Action Step in my Sequence.

The problem is, that ActivateWindow.vi doesn't work in TestStand, although it does when it is running in LabView.

 

Any Ideas?

 

 TestStand 4.1 / LabView 8.5

 

0 Kudos
Message 7 of 7
(3,799 Views)