04-07-2011 02:56 PM
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
04-08-2011 01:57 AM
Hi robojeff,
are you planning to use CVI or LabVIEW? ![]()
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.
04-08-2011 06:27 AM
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
04-08-2011 06:44 AM - edited 04-08-2011 06:48 AM
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
04-08-2011 08:52 AM
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
04-08-2011 09:30 AM
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.
04-08-2011 09:32 AM
I tried the following but I get an "Initializer must be constant" error:
04-08-2011 10:38 AM - edited 04-08-2011 10:47 AM
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);
04-08-2011 12:16 PM
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-...
04-08-2011 01:41 PM