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: 

Programatically send commands to any windows application

I want to send commands to other windows applications which are running on the background of labview.

I have an option through "send key ", but the application needs to be active window. But I don't want the application  to be an active window.

I think I need to get the handler for that application so that I can send commands to a particular application which ever I want to, but cannot find a way to do so.

 

0 Kudos
Message 1 of 11
(4,774 Views)

Hi kpraveen,

you can use the user32.dll functions to get the handle and to send messages.

See this link:

http://msdn.microsoft.com/en-us/library/ms633499(VS.85).aspx

 

and this

http://forums.ni.com/ni/board/message?board.id=170&message.id=338001&query.id=449931#M338001

 

Mike

0 Kudos
Message 2 of 11
(4,767 Views)

User32 LLBS are in LV4.0 version. I need them in lv 8.5.

0 Kudos
Message 3 of 11
(4,762 Views)
See here. They are in LV 8.2. You can use them for LV 8.2 & later versions.
- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 4 of 11
(4,752 Views)

i was able to control the application if the window was "active window" for me. But i want to send commands even if the window is not an acitve window for me. 

 

0 Kudos
Message 5 of 11
(4,721 Views)

i did also try FindwindowA() (user32.dll) and postmessageA() but was not sucessfull. The windows handle  from find window was always zero for me.

I took reference from below thread and msdn to use findwindow and postmessage functions.

http://forums.ni.com/ni/board/message?board.id=170&message.id=15281&query.id=519324#M15281

 

 

0 Kudos
Message 6 of 11
(4,716 Views)

Possibly a program called macro express could do this. It has an option to create macro commands that work only on certain windows and programs. Look at the macro scope options. Global, Global except, window specific, Program specific. I'm not 100% sure these will run on minimized windows, but it is a fairly cheap program around $60.

 

http://www.macros.com/index.htm

0 Kudos
Message 7 of 11
(4,702 Views)

Still i am not able to send commands .........

0 Kudos
Message 8 of 11
(4,651 Views)

Hi kpraveen,

see this link, inside off the zip file you'll find a working "FindWindowA" function.

 

Which commands do you want to send to your application?

 

Mike

0 Kudos
Message 9 of 11
(4,645 Views)
I was able to use "findwindow" and get the handle for the Non-Labview application. But I was not able to control or send commands and messages  using "postmessage" or "sendmessage" functions of user32.dll when this Non- labview application is not my active window. I was  able to send when Non- Labview application was active window.
0 Kudos
Message 10 of 11
(4,621 Views)