MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

How to start an application in the background using "oscmd" on windows

Is there any way to launch a windows application using oscmd without suspending xmath?
 
From a "cmd" window one can use the start command:
 
> start notepad
 
Which starts the application without suspending the "cmd" window.
 
From xmath command line, one may use:
 
> oscmd("start notepad")
 
This starts the application. However, the user cannot interact with xmath as long as the application is running.
 
Thanks
 
Xmath715, windows xp version 5.1 SP2
 
 
 
 
  
0 Kudos
Message 1 of 2
(11,712 Views)
Hi Farshid,

There is a command in the Shell API of Windows that runs an executable:

#include <utility.h>
#include <ansi_c.h>
#include <shellapi.h>
#include <windows.h>

int main (int argc, char *argv[])
{
    int res;
   
    if (InitCVIRTE (0, argv, 0) == 0)
        return -1;    /* out of memory */
    HINSTANCE stuff;
   
    stuff = ShellExecute(NULL, "open", "notepad.exe", NULL,NULL, SW_SHOW);
   
   
    printf("%i",stuff);
   
    return 0;
}

You can build a similar program into an executable and since the Parent executable will finish executing, control will return to XMath even while notepad is still open.

Richard

Field Sales Engineer, New Jersey
National Instruments
0 Kudos
Message 2 of 2
(11,680 Views)