Jump to content

Getting the name of the active window


Recommended Posts

I am upgrading my program helper tool and would like it to be able to detect what the name of the active widow is.

I initially tried the Active VI property node but it will only update the output string if something is selected which isn't always the case.

I've also tried the Open G Find VI with Focus.vi but it will only update the name string if the Front Panel is selected and not the Block Diagram.

Is there a windows API dll call or another VI that can tell me the name of the active window?

Link to comment
If you search on DevZone for the LabVIEW Utils package (lvwutil32.zip) I think there is a VI that does this and the DLL call is defined inside.

I downloaded these vis as you sugessted. The best I could do was to get a list of the application windows open. I could not get them to give me names of any of the Labview windows open.

After googleing around a while there seems to be a function in windows user32.dll called GetActiveWindow but I can't find the prototype for it.

Does anyone have any experience using the user32.dl or know where I can get the function prototypes for it.

Thanks

Link to comment
Here you go, I just cut and pasted from somewhere, so some clean up maybe required.

Hope this helps

Denis

That is exactly what I was looking for

Thanks. :thumbup:

I would still like to know how to get the windows dll prototypes.

If anyone can point me in that direction.

Link to comment

www.msdn.com

I find it very difficult to find stuff here, but if you put enough time into it you will find what you need.

In the past I have installed the MS SDK documentation from the LabWindows/CVI installation. This tool is much easier to use.

Good luck

Denis

Link to comment
www.msdn.com

I find it very difficult to find stuff here, but if you put enough time into it you will find what you need.

If you know the function name such as in this case it is very simple. OTherwise it is indeed hard to find something because of the sheer amount of information on that site. I little to borad of a term and you end up with thousends of links and usually some rather obscure ones (at least for people mainly interested in Win32 API) on the top.

For browsing more lasurely in the Win32 API an installation of the Microsoft SDK is quite handy. It is not talking about every possible MS soft but concentrates on the Windows API and family.

Rolf Kalbermatter

The Microsoft Developer Network is your best bet - just about all of the MS dll's are documented there. Be carfeul though: make sure the page you're looking at is appropriate for the OS you'll be working on (they often have diferent pages for the same named dll, but Win 95, 98, 2000...)

Actually Win95,98,2000 are usually on the same page if it is about Win32 API, or lets better say it sometimes still states that certain functions are available in older Windows versions. Microsoft is slowly getting mentioning of old and unsupported OS versions out of the docs when revisiting such said docs.

What I usually end up finding when looking for a particular API are the function descriptions of the Windows CE APIs in tenfold on the top of the found links before I sometimes get the link to the REAL API.

Rolf Kalbermatter

Link to comment

I use the APIViewer to get all of prototypes I use for windows functions. I agree that it is not too much fun trying to find the function you need on msdn. I had at one time found a page on msdn that listed all of the functions plus you could search them by functional group which helped. Unfortunatly I cannot find that page, nor do I have the bookmark. I might have deleted it becuase they got rid of it and restructured. I also used allapi.net when I first started searching for windows functions. It is ok, but they stopped supporting the site in 2002.

Link to comment
I use the APIViewer to get all of prototypes I use for windows functions. I agree that it is not too much fun trying to find the function you need on msdn. I had at one time found a page on msdn that listed all of the functions plus you could search them by functional group which helped. Unfortunatly I cannot find that page, nor do I have the bookmark. I might have deleted it becuase they got rid of it and restructured. I also used allapi.net when I first started searching for windows functions. It is ok, but they stopped supporting the site in 2002.

Having done some work in Wine and knowing the structure of the Wine code a bit I have to say that having a full source installation of said has helped me quite a bit. Not necessarily easy to find a particular function if you do not know where to look for but about how to achieve a lot of things. Wine code is usually good structured and rather high quality so learning from there is definitely not a bad thing.

Rolf Kalbermatter

Link to comment
  • 1 month later...
Here you go, I just cut and pasted from somewhere, so some clean up maybe required.

Hope this helps

Denis

I tried this out on my system (Windows XP, LV 7.1.1) and it will return the correct windows text length for LV windows, but the last dll call will not return the actual string. It works fine on other app. windows. Any ideas?

David

Link to comment
  • 1 month later...
I tried this out on my system (Windows XP, LV 7.1.1) and it will return the correct windows text length for LV windows, but the last dll call will not return the actual string. It works fine on other app. windows. Any ideas?

David

Not sure why you are having problems, works fine on my PC. WinXP LV8.0.1

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.