Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Lunch exe program

Posted on 2004-09-20
2
Medium Priority
?
1,088 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
l3st4rd earned 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 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