Click here to Skip to main content
15,893,564 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Setting File Creation Time Pin
Maximilien8-Jul-10 7:11
Maximilien8-Jul-10 7:11 
GeneralRe: Setting File Creation Time Pin
Fareed Rizkalla8-Jul-10 8:13
Fareed Rizkalla8-Jul-10 8:13 
QuestionRe: Setting File Creation Time Pin
David Crow9-Jul-10 3:18
David Crow9-Jul-10 3:18 
AnswerRe: Setting File Creation Time Pin
Emilio Garavaglia10-Jul-10 4:38
Emilio Garavaglia10-Jul-10 4:38 
QuestionSet C as default in VS2008? Pin
drolfson8-Jul-10 5:32
professionaldrolfson8-Jul-10 5:32 
QuestionRe: Set C as default in VS2008? Pin
CPallini8-Jul-10 6:30
mveCPallini8-Jul-10 6:30 
AnswerRe: Set C as default in VS2008? Pin
Aescleal8-Jul-10 20:25
Aescleal8-Jul-10 20:25 
QuestionShellExecuteEx path question. [modified] (fixed) Pin
Maximilien8-Jul-10 5:11
Maximilien8-Jul-10 5:11 
Edit : Issue was mostly with the spawned EXE that did not handled parameters properly.

Now everything is working ok.

Thanks.

I'm trying to figure out a couple of issues I have with some path that contains spaces when using ShellExecuteEx :

The current directory contains space : C:\Users\me\Documents\Visual Studio 2008\Projects\asdcasd\asdcasd

TCHAR Buffer[MAX_PATH];
DWORD dwRet;
dwRet = GetCurrentDirectory(MAX_PATH, Buffer);

// wrap the path with quotes
CString sWorkingPath;
sWorkingPath.Format( _T("\"%s\""), Buffer );

CString command ( _T("XMLtoPDF.exe"));
CString parameters( _T("")); // /noopen

// wrap the path with quotes.
CString sExe;
sExe.Format ( _T("\"%s\\%s\""), Buffer, command);

SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = _T("open");
ShExecInfo.lpFile = sExe;
ShExecInfo.lpParameters = parameters;
ShExecInfo.lpDirectory = sWorkingPath;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);


The exe spawns a console (it's a perl byte-compiled stand-alone) and tells me the path is not good : C:\Users\me\Documents\Visual does not exists.

I've checked the path and they all semms to be double-quoted to handle the spaces.

Am i missing something ?


Thanks a bunch.
Watched code never compiles.
modified on Thursday, July 8, 2010 3:52 PM

GeneralRe: ShellExecuteEx path question. Pin
David Crow8-Jul-10 5:37
David Crow8-Jul-10 5:37 
QuestionMS ActiveX Browser Popup Problem Pin
od@ananzi.co.za8-Jul-10 5:09
od@ananzi.co.za8-Jul-10 5:09 
QuestionPointer Corruption on accessing a class member variable Pin
apphia_j_798-Jul-10 4:29
apphia_j_798-Jul-10 4:29 
QuestionRe: Pointer Corruption on accessing a class member variable Pin
David Crow8-Jul-10 4:34
David Crow8-Jul-10 4:34 
AnswerRe: Pointer Corruption on accessing a class member variable Pin
Aescleal8-Jul-10 4:49
Aescleal8-Jul-10 4:49 
QuestionOLEDB Accessor mapping of 'bit' datatype Pin
Spawn@Melmac8-Jul-10 4:10
Spawn@Melmac8-Jul-10 4:10 
AnswerRe: OLEDB Accessor mapping of 'bit' datatype Pin
Code-o-mat8-Jul-10 6:06
Code-o-mat8-Jul-10 6:06 
AnswerRe: OLEDB Accessor mapping of 'bit' datatype Pin
Spawn@Melmac8-Jul-10 6:52
Spawn@Melmac8-Jul-10 6:52 
QuestionSystem Uptime Pin
sonualex8-Jul-10 3:36
sonualex8-Jul-10 3:36 
AnswerRe: System Uptime Pin
Code-o-mat8-Jul-10 3:52
Code-o-mat8-Jul-10 3:52 
GeneralRe: System Uptime Pin
sonualex8-Jul-10 23:20
sonualex8-Jul-10 23:20 
GeneralRe: System Uptime Pin
Code-o-mat8-Jul-10 23:29
Code-o-mat8-Jul-10 23:29 
GeneralRe: System Uptime Pin
sonualex9-Jul-10 1:43
sonualex9-Jul-10 1:43 
GeneralRe: System Uptime Pin
Code-o-mat9-Jul-10 1:53
Code-o-mat9-Jul-10 1:53 
AnswerRe: System Uptime Pin
David Crow9-Jul-10 3:20
David Crow9-Jul-10 3:20 
GeneralRe: System Uptime Pin
Code-o-mat9-Jul-10 3:23
Code-o-mat9-Jul-10 3:23 
GeneralRe: System Uptime Pin
David Crow9-Jul-10 3:25
David Crow9-Jul-10 3:25 

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.