From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI to obtain last active pop up for all open applications

Hello Community,

 

I am currently designing a Labview VI using the Windows API functions through the "call library function node" block to first, retrieves the handle of all windows, then check through each window what it's most recent pop up handle was and then pass that handle to the get windows text API to display an array with the list of most recent pop up titles.  I am trying to then compile this into an .exe file and run another VI that uses the three button dialog block to create a pop up that I can close, but I can't find the pop up anywhere on the list.  The list of names that I get is about 500 long each time and I don't really understand why it's that long.  I am very new to labview and working with the Windows API functions so any help with this would be great.  I have attached a screeny of the block diagram along with the front panel showing what I get at the output.  Just to be clear my questions are.

 

1. Is my block diagram wired to correctly do what I want?

2. Why is the list of names so long at the output?


Thx,

Sam

Download All
0 Kudos
Message 1 of 5
(2,770 Views)

Post your VI (not an image).

0 Kudos
Message 2 of 5
(2,743 Views)

woops, im such a newbie.

0 Kudos
Message 3 of 5
(2,735 Views)

According to the Microsoft API:


The return value identifies the most recently active pop-up window. The return value is the same as the hWnd parameter, if any of the following conditions are met:

  • The window identified by hWnd was most recently active.
  • The window identified by hWnd does not own any pop-up windows.
  • The window identifies by hWnd is not a top-level window, or it is owned by another window.

As such, you're getting a lot of things that aren't actually pop-ups.  I would recommend checking to see if the return value is the same as the input value, and if so discarding the reference.

0 Kudos
Message 4 of 5
(2,710 Views)

I made a case structure in accordance with your recommendation and now I am getting an array list that doesn't have anything in it. 

0 Kudos
Message 5 of 5
(2,683 Views)