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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

executing another executable without pressing the application button

hi to all,

Hope you can help me with this, i will greatly appreciate it. I have created an application using VisualC++ (MFC) with buttons (e.g. START, STOP, EXIT and others), The application is OK and working and i want to call this application to my another project in Labwindows/CVI v6. I have used the LaunchExecutable and system(), i works yes by calling the MFC executable but i have to press the START BUTTON again of the MFC application to make it run.

What I want to do is run my application(CVI app) then will call the MFC app and the MFC app will automatically RUN without pressing the START BUTTON on it. Is it possible??
________________________________________________________________
Electronics Manufacturing Tester Forum
0 Kudos
Message 1 of 7
(3,017 Views)
In message <506500000008000000AFD20000-1079395200000@exchange.ni.com>,
psycho writes
>hi to all,
>
>Hope you can help me with this, i will greatly appreciate it. I have
>created an application using VisualC++ (MFC) with buttons (e.g. START,
>STOP, EXIT and others), The application is OK and working and i want
>to call this application to my another project in Labwindows/CVI v6. I
>have used the LaunchExecutable and system(), i works yes by calling
>the MFC executable but i have to press the START BUTTON again of the
>MFC application to make it run.
>
>What I want to do is run my application(CVI app) then will call the
>MFC app and the MFC app will automatically RUN without pressing the
>START BUTTON on it. Is it possible??

One way is to modify your
MFC application to use command line arguments
(I'm a C programmer and assuming you can do this in C++).

So if your CVI application calls your C++ application with a first
argument of 'R' say then your C++ application runs.

By default your windows short cuts will not have the 'R' and the
application will run as normal when manually launched.
--
Regards,

John Cameron.
Type softly, read gently.
0 Kudos
Message 2 of 7
(3,017 Views)
Hi,

I have to agree here with John, you need to create some sort of interface between your MFC application and CVI. There are many different ways to do it, but the fastes to implement by far is the command line arguments. Here is a document that I found on the web that can help you implemet that. Basically you have global variables that hold the arguments that the customer passed to the app.

How To Access Command Line Arguments

Good Luck.

Regards,
Juan Carlos
N.I.
0 Kudos
Message 3 of 7
(3,017 Views)
Thanks to john and you Juan, my app is now working as instructed by both of you., but one more thing how about if i dont have the source code of the MFC app just an executable file. Is it possible to run this MFC app(with start button)on the CVI?
________________________________________________________________
Electronics Manufacturing Tester Forum
0 Kudos
Message 4 of 7
(3,017 Views)
In message <50650000000500000028830100-1079395200000@exchange.ni.com>,
psycho writes
>Thanks to john and you Juan, my app is now working as instructed by
>both of you., but one more thing how about if i dont have the source
>code of the MFC app just an executable file. Is it possible to run
>this MFC app(with start button)on the CVI?

If the MFC application is an Active X server and that is one of the
functions it makes available via Active X then yes. It's also possible
that you can make control requests of it by TCP/IP or DDE. But it all
depends on what the original writer of the application included.
--
Regards,

John Cameron.
Type softly, read gently.
0 Kudos
Message 5 of 7
(3,017 Views)
Hi,
There is the possibility of generating a fake mouse click once your MFC application starts. It's not a very reliable technique but it's easy to implement.
The windows SDK has a function called mouse_event that allows you to generate this fake amouse clicks; you can find more info on it in the Windows SDK help menu in CVI.
Good luck.
Juan Carlos
0 Kudos
Message 6 of 7
(3,017 Views)
Another way is to implment such an interfface is to create an ini file (or
strore the intermedialy message is the registry. Whenewer your application
strats, it reads the configuration file (ini file or the registry) finds the
instructions and data that anothere application passes to it, and deletes
that message after it executes the commands.
This is an overkill this time, but can be effective in more complex
situations.
Lajos


"psycho" wrote in message
news:506500000008000000AFD20000-1079395200000@exchange.ni.com...
> hi to all,
>
> Hope you can help me with this, i will greatly appreciate it. I have
> created an application using VisualC++ (MFC) with buttons (e.g. START,
> STOP, EXIT and others), The application is OK and working and i want
> to call
this application to my another project in Labwindows/CVI v6. I
> have used the LaunchExecutable and system(), i works yes by calling
> the MFC executable but i have to press the START BUTTON again of the
> MFC application to make it run.
>
> What I want to do is run my application(CVI app) then will call the
> MFC app and the MFC app will automatically RUN without pressing the
> START BUTTON on it. Is it possible??
0 Kudos
Message 7 of 7
(3,017 Views)