Click here to Skip to main content
15,881,812 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCreateProcess doesn't work while ShellExecute Does!!!! Pin
YaronNir30-Nov-05 3:25
YaronNir30-Nov-05 3:25 
AnswerRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
Cedric Moonen30-Nov-05 3:46
Cedric Moonen30-Nov-05 3:46 
GeneralRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
YaronNir30-Nov-05 3:51
YaronNir30-Nov-05 3:51 
AnswerRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
Gavin Taylor30-Nov-05 4:15
professionalGavin Taylor30-Nov-05 4:15 
GeneralRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
YaronNir30-Nov-05 4:50
YaronNir30-Nov-05 4:50 
QuestionRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
David Crow30-Nov-05 8:03
David Crow30-Nov-05 8:03 
AnswerRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
YaronNir30-Nov-05 20:26
YaronNir30-Nov-05 20:26 
AnswerRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
Daniel Lohmann30-Nov-05 10:36
Daniel Lohmann30-Nov-05 10:36 
Two potential reasons:

1) the lpCommandLine parameter of CreateProcessW() is the white-space delimited list of arguments passed as argv to the new process. If ACDSee expects to find the path to its own executable in argv[0] the above would fail, as your path contains whitespaces. Basically the result of the above would be: argv[0]="C:\Program", argv[1]="Files\ACD", argv[2]="Systems\ACDSee\6.0}ACDSee6.exe"

You should quote the string, e.g. pass it as:

L"\"C:\\Program Files\\ACD Systems\\ACDSee\\6.0\\ACDSee6.exe\""

2) The UNICODE-Version of CreateProcess() may fail on NT/2k/XP if the parameter passed as lpCommandLine points to a constant string. This is explicitly mentioned in MSDN. Note that the type is LPWSTR, not LPCWSTR. Maybe you should copy your string to a modifiable buffer and pass this buffer to CreateProcessW():

I usually pass NULL for the lpApplication parameter and only use lpCommandLine. Of course, you have to make sure that a path containing white-spaces is quoted in this case (as described above). ShellExecute() is intended to be more "user friendly", that is it applies some heuristics to resolve pathes containing white spaces and does other "magic stuff".


Hope that helps

--

Daniel Lohmann

http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there Big Grin | :-D )
GeneralRe: CreateProcess doesn't work while ShellExecute Does!!!! Pin
YaronNir30-Nov-05 20:26
YaronNir30-Nov-05 20:26 
Questionprint Pin
viliam30-Nov-05 2:46
viliam30-Nov-05 2:46 
QuestionRe: print Pin
David Crow30-Nov-05 2:55
David Crow30-Nov-05 2:55 
QuestionActiveX Controls in VS 7.1 Pin
sweep12330-Nov-05 2:03
sweep12330-Nov-05 2:03 
QuestionDeviceIoControl() & COM1 Pin
button_basher30-Nov-05 1:45
button_basher30-Nov-05 1:45 
QuestionHow to make a child window appear on TaskBar Pin
pradish30-Nov-05 0:58
pradish30-Nov-05 0:58 
QuestionMFC in VC 2005 beta version Pin
narayanagvs30-Nov-05 0:52
narayanagvs30-Nov-05 0:52 
AnswerRe: MFC in VC 2005 beta version Pin
Cedric Moonen30-Nov-05 1:14
Cedric Moonen30-Nov-05 1:14 
QuestionThe procedure entry point Rtllpv4StringToAddressW in NTDLL.dll Pin
zinc_z30-Nov-05 0:43
zinc_z30-Nov-05 0:43 
AnswerRe: The procedure entry point Rtllpv4StringToAddressW in NTDLL.dll Pin
Mike Dimmick30-Nov-05 3:46
Mike Dimmick30-Nov-05 3:46 
QuestionProblem with Registry Backup Pin
rajeevktripathi30-Nov-05 0:10
rajeevktripathi30-Nov-05 0:10 
AnswerRe: Problem with Registry Backup Pin
Rajesh R Subramanian30-Nov-05 1:35
professionalRajesh R Subramanian30-Nov-05 1:35 
AnswerRe: Problem with Registry Backup Pin
David Crow30-Nov-05 2:32
David Crow30-Nov-05 2:32 
AnswerRe: Problem with Registry Backup Pin
Gavin Taylor30-Nov-05 2:40
professionalGavin Taylor30-Nov-05 2:40 
Questionhow can i access a remote machine Pin
sarvendu30-Nov-05 0:01
sarvendu30-Nov-05 0:01 
QuestionRe: how can i access a remote machine Pin
David Crow30-Nov-05 2:35
David Crow30-Nov-05 2:35 
AnswerRe: how can i access a remote machine Pin
sarvendu30-Nov-05 19:22
sarvendu30-Nov-05 19:22 

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.