04-08-2011 02:51 PM - edited 04-08-2011 02:57 PM
robojeff:
Roberto included some snippets of code, not fully working examples. He expected that you would recognize that and know what to do with the snippets.
From the errors you reported, it looks like you didn't define a main function and just tried to directly compile Roberto's snippets.
Function calls need to be within another function. For simple executable programs, one of your functions is typically main(). Do you have a good intro C programming reference you can review?
C is also case sensitive. That means that FILE is not the same as file. FILE is actually a reserved keyword in ANSI C. Your Example 2 expects them to be the same.
As an example, here's how you could compile what you label Example 1.
#include <utility.h>
#include <ansi_c.h>
#include <userint.h>
main()
{
static char file[] = "notepad.exe";
LaunchExecutable (file);
}
04-08-2011 03:02 PM
Thanks Al-
my bad, I thought that his examples were complete and that in LabWindows I could run what he supplied without adding anything...
I know how to write C code but like I said, I am new to labWindows CVI and am assuming that I can take what is supplied to me at face value without making additional assumptions.
04-08-2011 03:07 PM - edited 04-08-2011 03:13 PM
robojeff:
LabWindows/CVI is an ANSI C development environment, with some great libraries for dealing with user interface and test equipment. But at the base level, it is just ANSI C. So if you already know how to program in C, you have a good head start. If it doesn't make sense in C, it doesn't make sense in CVI.
For complete examples, look at the example projects in my first post to your question.
04-08-2011 03:31 PM
Fair enough Al... It is all starting to come back to me after being away from C for the past 5-6 years and using other
languages since...
This method of launching the applications works well now and I thank you for setting me straight.
All I need to figure out now is how to send extended keystrokes to these applications. I was able to download the Windows SDK but have
not found any examples yet on how to send the key strokes such as alt, tab, shift, Ctl, & enter...
I am a little surprised with the age and maturity of labwindows (I used it back in the late 80's) that the hooks for these types of standard interfaces, such as sending keystrokes and controlling handles for controls on the dialogs within other Windows applications are not built in to labwindows as they are with other scripting applications that are available...
That said, I greatly appreciate any info on other means to control these items.
04-08-2011 03:37 PM - edited 04-08-2011 03:39 PM
robojeff:
Look at my example WriteText2AnotherApp I posted earlier today. It includes Shift, Alt, and Control. Tab and Enter are not anything special. In ANSI C, tab = '\t', Enter = '\n'.
National Instruments has made some tweaks to the SDK. You said you downloaded the SDK. You need to use the version that ships with CVI.
04-08-2011 06:15 PM
Thanks Al-
I didn't see the control and alt keys in there but I will take a closer look. Just curious, is it easy to use
the arrow keys also?
I would prefer to get a handle on each of the controls as this way always seems to be a more consistent way to control a window. Sending keystrokes and arrows can get skewed at times, especially when it is not always easy to determine what state or what control is being indexed..
04-16-2011 01:17 PM
robojeff:
Take a look at this thread: http://forums.ni.com/t5/LabWindows-CVI/access-control-using-panel-handle/m-p/1495706