Problems with CreateProcess()

Hi Guys,

I am trying to call a batch file from my code... only I keep getting a wired error:

error: cannot convert `char*' to `_SECURITY_ATTRIBUTES*' for argument `3' to `BOOL CreateProcessA(const CHAR*, CHAR*, _SECURITY_ATTRIBUTES*, _SECURITY_ATTRIBUTES*, BOOL, DWORD, void*, const CHAR*, _STARTUPINFOA*, _PROCESS_INFORMATION*)'


This is when I pass the following to the function:

1
2
3
4
5
//Set the string to be executed
szBuffer = string("//c \"\\\\cse2k301\\cse$\\scripts\\ADS\\nctcbanet.bat \"" + szUserName + " " + szYearGrp);
strcpy(csz, szBuffer.c_str());
//Create the process
CreateProcess(NULL, "C:\\WINDOWS\\system32\\cmd.exe", csz);


Has anyone used this method before, or can offer advice on how to get around it??

Many Thanks,

SwanSong
Nevermind, found what I had done wrong... I used bad information from another user on the msdn site to send me off track! Anyone having problems with CreateProcess() should look at this for inspiration: http://msdn.microsoft.com/en-us/library/ms682512(VS.85).aspx

SwanSong
Topic archived. No new replies allowed.