LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Launching and controlling other applications from LabView.

I am new to Labwindows CVI and I am wondering if there are any good tutorials showing an easy way to Launch and manipulate the controls on other applications from LabView v 2010.

 

I am using an XP system and I'm also interested in knowing how to identify the other application(s') controls from within labwindows.

 

thanks  

0 Kudos
Message 1 of 17
(4,884 Views)

Hi robojeff,

are you planning to use CVI or LabVIEW? Smiley Surprised

 

If you are on CVI side then you may find this post from nickb useful to scan running processes on your machine and identify the one you want to use.

With reference to communicating with the other process, the usual problem is that the normal way to do it is that both processes are prepared to do that some way: DDE, ActiveX, TCP/IP, DataSocket, Network variables... without knowing what the second program is we can't be of much help to you.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 17
(4,874 Views)

Hi Roberto-

 

The other applications that I wish to launch and control are ones that were created by people in our company.

 

I am interested in starting these application within my LabWindows CVI application and then selecting drop down menus, click buttons and read the clipboard for certain status udpates from this other software.

 

thanks for your advice

0 Kudos
Message 3 of 17
(4,869 Views)

Well, if you don't want to adapt the other applications, you may try to fake some keystroke to activate proper functions in them. I never really tried it but you can find this solution described in this thread

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 17
(4,865 Views)

Hi Roberto-

 

I looked at that thread and it has some promise but there seems to be a portion of information missing. Mostly what I saw in the example there was using ASCII values which is fine for most keys but does not cover other keys that I need to send.

 

Also, there was a link on that thread which led to a MSDN page with the heading of "Keyboard Input Overviews" which left me with no idea of how to find the correct path for any useful information related to what I am looking for...

 

Is there a link to the format of some of these SDK commands and info on how to do extended keystrokes and special keys such at Alt, Tab, & Enter?

 

Thanks again

0 Kudos
Message 5 of 17
(4,846 Views)

Unfortunately I have no direct answer to your question; I bookmarked that thread since it seems promising, as you too have noticed. Unfortunately as I already told you I had no time to test such solution even if I wanted to.

Let's see if anyone else hase more precise informations regarding this subject.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 17
(4,836 Views)

I tried the following but  I get an "Initializer must be constant" error:

 

 

#include <windows.h>
#include <utility.h>
int stat;
char filename[] = "C:\\Program Files\\myfile\\myfile.exe";
stat= LaunchExecutable(filename);

 

 

0 Kudos
Message 7 of 17
(4,835 Views)

This works:

 

char    file[MAX_PATHNAME_LEN];


strcpy (file, "notepad.exe");
LaunchExecutable (file);

 

 

EDIT   This one too on my machine (interactive execution window):

 

#include <utility.h>
#include <ansi_c.h>
#include <userint.h>
static char    file[] = "C:\\Program files\\Real\\RealPlayer\\realplay.exe";


LaunchExecutable (file);



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 17
(4,828 Views)

robojeff:

 

I have attached a sample program which allows you to select a program to launch, and then use the Windows SDK function keybd_event() to send keystrokes to the other app.  It doesn't give you complete control over the other app, but it lets you do just about anything that you can do with simple keystrokes (including Alt-combinations).  Look at the readme.txt file in the attached zip file for instructions on building the files you need.

 

In the list of files that can be launched, I have included a CVI app (included in the workspace file), and windows Notepad and Calculator.  You can also launch your own file by right-clicking on the file selection box.  The controlling sample app selects different controls (a textbox and an LED) on the CVI_test_app by the Alt-combination shortcut keys.  That same kind of customization may apply to different apps as well.  For the Windows Notepad and Calculator, it just opens them and writes text.  The default text if the Calculator is chosen is "2+2=".  Writing straight text results in an error on the Calculator.

 

In order to build this project, you need to have the Windows SDK installed, which is included in the CVI Full Development System and the NI Developer Suite (but not in the CVI Base package).   It's an option, not installed by default.  So if you don't have it, you need to reinstall CVI and select a custom install to select the SDK (or Windows API in later versions).

 

For more control over other windows, you may also want to look at my older example WindowControl.prj described and posted here: http://forums.ni.com/t5/LabWindows-CVI/Launch-CVI-created-program-minimized-from-within-other-CVI/m-...

Message 9 of 17
(4,817 Views)

 

I tried your examples and found that for some reason they do not work on my PC:
Example1:
#include <utility.h>
#include <ansi_c.h>
#include <userint.h>
static char    file[] = "notepad.exe";
LaunchExecutable (file);
ERRORS OUT WITH:
 7, 24   Extraneous formal parameter specification.
 7, 24   Redeclaration of 'LaunchExecutable' with different calling convention, previously declared at utility.h:639.
Example2:
#include <utility.h>
#include <ansi_c.h>
#include <userint.h>
static char file[MAX_PATHNAME_LEN];
strcpy  (FILE, "notepad.exe");
LaunchExecutable (file);
ERRORS OUT WITH:
 6, 15   Missing parameter type.
 6, 15   syntax error; found 'string constant' expecting ')'.
 6, 29   Redeclaration of 'strcpy' previously declared at string.h:45.
 8, 24   Extraneous formal parameter specification.
 8, 24   Redeclaration of 'LaunchExecutable' with different calling convention, previously declared at utility.h:639.
thanks

 

0 Kudos
Message 10 of 17
(4,813 Views)