Click here to Skip to main content
15,925,309 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General(Win32 Error 11) Pin
Neville Franks24-Jun-01 3:50
Neville Franks24-Jun-01 3:50 
GeneralRe: (Win32 Error 11) Pin
Anders Molin24-Jun-01 4:40
professionalAnders Molin24-Jun-01 4:40 
GeneralRe: (Win32 Error 11) Pin
Neville Franks24-Jun-01 5:01
Neville Franks24-Jun-01 5:01 
GeneralResizing Controls Pin
23-Jun-01 23:55
suss23-Jun-01 23:55 
GeneralRe: Resizing Controls Pin
Ben Burnett24-Jun-01 10:26
Ben Burnett24-Jun-01 10:26 
GeneralRe: Resizing Controls Pin
Blake Miller25-Jan-05 7:23
Blake Miller25-Jan-05 7:23 
GeneralCreateProcess Pin
23-Jun-01 13:13
suss23-Jun-01 13:13 
GeneralRe: CreateProcess Pin
23-Jun-01 19:09
suss23-Jun-01 19:09 
I am not quite sure if you need help with creating a thread or with creating a process. The sample code below should help you to create a process.

BOOL CreateProcess(const CString& strDir, const CString& strApp, const CString& strCmdLine)
{
BOOL bRetCode;

VERIFY((strApp.GetLength() < _MAX_PATH));
VERIFY((strDir.GetLength() < _MAX_PATH));
VERIFY((strCmdLine.GetLength() < _MAX_PATH));

char szAppBuf[_MAX_PATH]; memset(szAppBuf, '\0', _MAX_PATH);
char szCmdBuf[_MAX_PATH]; memset(szCmdBuf, '\0', _MAX_PATH);
char szDirBuf[_MAX_PATH]; memset(szDirBuf, '\0', _MAX_PATH);

STARTUPINFO startup;
PROCESS_INFORMATION processInfo;

startup.cb = sizeof (STARTUPINFO);
startup.lpReserved = 0;
startup.lpDesktop = NULL;
startup.lpTitle = NULL;
startup.dwX = 0;
startup.dwY = 0;
startup.dwXSize = 0;
startup.dwYSize = 0;
startup.dwXCountChars = 0;
startup.dwYCountChars = 0;
startup.dwFillAttribute = 0;
startup.dwFlags = 0;
startup.wShowWindow = 0;
startup.cbReserved2 = 0;
startup.lpReserved2 = 0;

strcpy(szAppBuf, (LPCSTR) strDir);
strcat(szAppBuf, (LPCSTR) strApp);

strcpy(szDirBuf, (LPCSTR) strDir);
strcpy(szCmdBuf, " "); //For some reason CreateProcess
//requires more than 1 space padding around command line

if (strCmdLine.GetLength() > 0)
{
strcat(szCmdBuf, (LPCSTR) strCmdLine);
}

bRetCode = ::CreateProcess(
(LPCTSTR) szAppBuf, // pointer to name of executable module
(LPTSTR) szCmdBuf, // pointer to command line string
NULL, // pointer to process security attributes
NULL, // pointer to thread security attributes
FALSE, // handle inheritance flag
0, // creation flags
NULL, // pointer to new environment block
(LPCTSTR) szDirBuf, // pointer to current directory name
&startup, // pointer to STARTUPINFO
&processInfo // pointer to PROCESS_INFORMATION
);
if (bRetCode == TRUE)
return TRUE;

return FALSE;
}




Gaulles
GeneralRe: CreateProcess Pin
Ben Burnett24-Jun-01 10:31
Ben Burnett24-Jun-01 10:31 
GeneralWindow Close Button Pin
Brad Schroeder23-Jun-01 11:52
Brad Schroeder23-Jun-01 11:52 
GeneralRe: Window Close Button Pin
Michael Dunn23-Jun-01 14:40
sitebuilderMichael Dunn23-Jun-01 14:40 
GeneralRe: Window Close Button Pin
Brad Schroeder23-Jun-01 15:14
Brad Schroeder23-Jun-01 15:14 
GeneralActiveX MFC Pin
Merl'23-Jun-01 1:32
Merl'23-Jun-01 1:32 
Generalsocket problem Pin
Muslim22-Jun-01 19:57
Muslim22-Jun-01 19:57 
GeneralCreating SQL in store procedure Pin
Kathrin22-Jun-01 14:48
Kathrin22-Jun-01 14:48 
GeneralRe: Creating (none answer my question) Pin
Kathrin25-Jun-01 0:56
Kathrin25-Jun-01 0:56 
GeneralRe: Creating (none answer my question) Pin
Tim Deveaux25-Jun-01 5:16
Tim Deveaux25-Jun-01 5:16 
GeneralPAVISTREAM * as member variable Pin
Jake Palmer22-Jun-01 13:32
Jake Palmer22-Jun-01 13:32 
GeneralRe: PAVISTREAM * as member variable Pin
Bret Faller22-Jun-01 13:50
Bret Faller22-Jun-01 13:50 
GeneralStarting a program hidden (Tray Icon) Pin
Bret Faller22-Jun-01 13:09
Bret Faller22-Jun-01 13:09 
GeneralRe: Starting a program hidden (Tray Icon) Pin
22-Jun-01 20:09
suss22-Jun-01 20:09 
GeneralRe: Starting a program hidden (Tray Icon) Pin
Frank Deo23-Jun-01 4:37
Frank Deo23-Jun-01 4:37 
GeneralRe: Starting a program hidden (Tray Icon) Pin
Bret Faller25-Jun-01 6:26
Bret Faller25-Jun-01 6:26 
GeneralRe: Starting a program hidden (Tray Icon) Pin
Bret Faller25-Jun-01 6:34
Bret Faller25-Jun-01 6:34 
GeneralRe: Starting a program hidden (Tray Icon) Pin
Frank Deo25-Jun-01 9:56
Frank Deo25-Jun-01 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.