Solved

Lunch exe program

Posted on 2004-09-20
2
1,066 Views
Last Modified: 2013-11-20
Can anyone help me to write C++ code to lunch exe program from SAMBA server?
0
Comment
Question by:tthawee
2 Comments
 

Accepted Solution

by:
l3st4rd earned 50 total points
ID: 12107956
what u mean: "lunch exe program from SAMBA server" ? the program resides on a connected network drive?
if so you only need to call CreateProcess(...).

CString pathName;
pathName = YourProgramPath;
STARTUPINFO startup;   //structure containing information on how to start the program
PROCESS_INFORMATION procinfo;   //this will receive information on the newly created process

::ZeroMemory(&startup, sizeof(startup));  //clear startup structure

startup.cb = sizeof(startup);   //size of this structure
startup.dwFlags = STARTF_USESHOWWINDOW;    //use wShowWindow flag
startup.wShowWindow = SW_SHOW;    //show the window in normal state
pathName = "\"" + pathName + "\"";     //include the pathname into quotation marks to deal with spaces in pathnames

LPSTR cmd = ClientCmd.GetBuffer(ClientCmd.GetLength() + 1);
if (CreateProcess(NULL, //name of application already contained in lpCommandLine parameter
                         cmd,   //lpCommandLine = full / relative path of program + parameters
                         NULL,  // }
                         NULL,  // } no security attributes for thread as well as process
                     false,  //the new process should not inherit any handles from the calling process
                         0,       //we specify no creation flags
                         NULL,  //new process runs in same environment as calling process
                         NULL,  //the current drive+directory of the new process will be the same like the one of the calling process
                         &startup,  //our startup information
                         &procinfo)   //this will receive information on the new process
                         == 0) {   //return value 0 means error:
// add an error handler here if execution failed
}

have a look for CreateProcess function in MSDN for more info.

daniel.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Whole sheet autoscrub still needed 19 44
sum67 challenge 35 89
wait notify demo infinite loop 3 80
zeroFront challenge 7 71
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now