LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you use the windows User32.dll Library functions to read variables from other applications that are running

I am trying to read a text box from a programme running at the same time as my Labview application using calls to the Windows
User32.dll. I believe I need to find the window handle for the 'form' containing this text string and use this together with
various other defined input variables to access the sting.
 
I have no experience of using this 'Call Library Function Node', but have an understanding of the 'C' programming language. Does anyone have
example Labview code showing how this might be done.
 
Thanks
 
0 Kudos
Message 1 of 11
(15,410 Views)
If you're trying to access information that's being displayed in the window of another application and that application has no ActiveX interface, then yes, Windows calls can be used. There's a very good example on calling DLLs that ship with LabVIEW. Open the Example Finder (Help->Find Examples) and switch to the Search tab. Enter "Call" in the search box and open the VI "Call DLL". Run the VI, select any of the examples, and click the "Open Example VI..." button. That shows you how to call a DLL.

Now, given that you have no experience in calling DLLs, have only an "understanding" of C (which to me means you have never written something like a DLL), and don't seem to know that much about what Windows functions you may need, you're going to find this route pretty difficult, especially since you have to deal with Windows API calls, which are not always that easy to do from LabVIEW.

Let me propose an alternate solution. Go over to http://www.autoitscript.com/autoit3/ and download AutoIt. This is an automation tool that allows you to automate just about anything you want. It has an ActiveX interface that you can call from LabVIEW. I've attached an example VI that shows you how to use it to get the value of a text box from one of the tabs in the computer "System Properties" control panel applet.
Message 2 of 11
(15,379 Views)

smercurio_fc

Your a star !! I quickly adapted the vi you send me to successfully read a text box from my other programme which was running.

When I create an executable or installer routine for my programme in Labview are there any files I have to make reference to from the programme ‘AutoIT v3’ ?

 

Next time your down this way, I will buy you beer (Liphook, Hants UK);  many thanks for your good advice.

0 Kudos
Message 3 of 11
(15,342 Views)
You would just need to make sure AutoIt is installed on the target machine. The program just picks up the ActiveX reference through Windows. If you want to include the AutoIt installation, follow the steps in this KB article: How Do I Make My LabVIEW-built Installer Run an Executable After Installation?

Oh, and thanks for the beer offer.Smiley Wink

Message Edited by smercurio_fc on 10-05-2007 09:11 AM

Message 4 of 11
(15,331 Views)

Hi,

i want to activate the child window inside the parent window.

i mean i am able to call the child window but it is not active. i have to move the window in the parent window to make it active.

i don't know how to use show window() function.

can anybody help me in this?

Thanks.

Regards,
Dev
CLD Certified Engineer
0 Kudos
Message 5 of 11
(14,977 Views)
You'll need to be a bit more specific. What child window inside what parent window? And what show window() function are you referring to? Is this about AutoIt? There is no "ShowWindow()" function in AutoIt as far as I know. This sounds like you're asking a completely different question, and should perhaps start a new thread.
0 Kudos
Message 6 of 11
(14,951 Views)

Hi Dev,

the user32.dll contains a ShowWindow function, but as smercurio already said, please be a bit more specific.

Hope it helps. Mike



Message Edited by MikeS81 on 07-10-2008 04:04 PM
0 Kudos
Message 7 of 11
(14,948 Views)

Hi Mike,

Thanks.It really helped.

Now I am able to activate the child window using user32.dll showWindow() function.

Next time i will try to make the problem more clear in the post.

 

Regards,
Dev
CLD Certified Engineer
0 Kudos
Message 8 of 11
(14,931 Views)

Hello, Smercurio, I hope you are still active in the forum.

Just realized that I have not graduated when the solution was posted.

 

I had simailar requirement to read data string from another program window,

I downoaded the autoit software and your labview code, however after I ran the vi, nothing showed up in the controgettext indicator

and I did have some charater under computer description.

 

Could you briefly explain what the vi does and what the autoit software does in this example?

 

Thanks a lot. 

 

0 Kudos
Message 9 of 11
(13,332 Views)

FYI  you may need to re-select the active x class of teh automation refnum control in the  in the posted example after you install Autoit.

Mark Ramsdale
Program Manager & CLA
Global Demo and Equipment at National Instruments
0 Kudos
Message 10 of 11
(12,030 Views)