06-23-2011 05:11 PM - edited 06-23-2011 05:16 PM
I got the handle ID, but then when I subsequently re-open the window, it has a different handle ID everytime. What is up with that?
06-24-2011 03:10 AM
Well did the software restart in between? Are there multiple windows with the same title? Every time a window is destroyed and recreated the handle will be different. If that other software is created in LabVIEW there are certain actions to a window that can cause the window to be destroyed and recreated on the fly without you noticing as much as a flickering. The handle you receive could be also an alias that Windows creates. Trying to interpret this value is of absolutly no use. It's internal behaviour is absolutely undocumented and can change depending on Windows version, user mode, or whatever else the Microsofties have felt like.
06-24-2011 02:30 PM - edited 06-24-2011 02:32 PM
I am the one destroying the window, via closing it. I got it now. The window receives a new handle ID every time it is (re)spawned. That is why I saw an example whereas it first acquires the handle ID from the Window Title and then applies setwindowfocus to the newly acquired handle ID.
Is there an easier way to set window focus?
06-24-2011 04:14 PM - edited 06-24-2011 04:15 PM
I now see that I have to use "Move Window to Top.vi".
I was trying to test it out and it did find the handle ID of the window, but it is not bringing the window to the top.
It doesn't do much when I try to run it via LV. So what am I doing wrong?
06-24-2011 04:18 PM
Don't know, because we can't see what you're doing. What did you enter for the window name in the "Move Window to Top" VI? Does this match the name of the window you're trying to bring to the top? Can you post a screenshot of what things look like, with the window you're trying to bring to the top, along with the "Move Windot to Top" VI? PLEASE DO NOT POST BITMAPS. Save the screenshot as a PNG file. DO NOT RENAME THE FILE BY CHANGING THE EXTENSION - THIS DOES NOT CHANGE THE FORMAT OF THE FILE. Yes, I'm yelling, because people do this all the time.
06-24-2011 04:22 PM
06-24-2011 04:25 PM - edited 06-24-2011 04:27 PM
I just noticed that the window "U:\Temp" is now the top window no matter what window I select. "U:\Temp" remains at the very top.
Am I using the incorrect function?
I am trying to make a window the active window.
06-24-2011 05:24 PM
That's the correct VI, and the correct usage, but I thought you were trying to do this on a dialog? Whatever window you specify in that VI gets brought the front once. It's not pinned to the front. Are you using the Run Continuously button? Just asking.
06-24-2011 05:29 PM
I was just doing a test is why it is not showing a dialog box.
I am not Running Continuously.
06-24-2011 06:38 PM - edited 06-24-2011 06:39 PM
"Move Window to Top" is working fine. What happened was I read further and discovered that it does not activate a window unless it is in the foreground. I then moved my window to the foreground and "Move Window to Top" set the focus to my window!