Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky23-Jan-14 18:00
a_matseevsky23-Jan-14 18:00 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
jschell24-Jan-14 12:17
jschell24-Jan-14 12:17 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky24-Jan-14 16:22
a_matseevsky24-Jan-14 16:22 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
jschell25-Jan-14 12:37
jschell25-Jan-14 12:37 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky25-Jan-14 18:56
a_matseevsky25-Jan-14 18:56 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
jschell26-Jan-14 12:29
jschell26-Jan-14 12:29 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky26-Jan-14 20:24
a_matseevsky26-Jan-14 20:24 
QuestionShellExecuteEx with Windows 8 Pin
Member 147103916-Jan-14 8:16
Member 147103916-Jan-14 8:16 
The purpose of the code is to convert an XPS file to PDF using the external GhostXPS converter program (gxps.exe).

It's a fairly simple process and works flawlessly with everything tested up to Windows 8. It has been tested on XP, various flavors of Windows 7 and Server 2008 R2. Even using the same instructions from cmd line in Windows 8 is successful.

for clarity:

"path" is the entire path where gxps.exe is installed.
"filename" is the complete path of the xps file to convert
"retStr" is the complete path of the pdf file as converted (same as filename only with a pdf extension).

The file paths of filename and retStr are C:\Users\"username"\AppData\Local\Temp directory so permission issues should not be a concern.

Code follows:

CString progName( path + _T("gxps.exe ") );

sParam.Format(_T("-sDEVICE=pdfwrite -sOutputFile=%s -dNOPAUSE %s"), retStr, filename );

SHELLEXECUTEINFO sei = {0};
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.hwnd = NULL;
sei.lpVerb = NULL;
sei.lpFile = progName;		
sei.lpParameters = sParam;	
sei.lpDirectory = NULL;
sei.nShow = SW_HIDE;
sei.hInstApp = NULL;

if ( ShellExecuteEx(&sei) )
{
   // Wait for process to terminate
   ::WaitForSingleObject(sei.hProcess, INFINITE);
} 

CloseHandle(sei.hProcess);




Curiously, the gxps program executes without indicated error. The result of execution is "42" which according to the MSDN docs is a success code. However the result is always a blank 760 byte pdf with no content. Breakpoints indicate the XPS is completely valid before conversion.

I've never seen a command line program return a different result when executed from cmd or ShellExecuteEx and am completely baffled.

Does anyone have any ideas on what is happening here or has anyone else experienced a similar problem with ShellExecuteEx?

Thanks in advance for any assistance.
AnswerRe: ShellExecuteEx with Windows 8 Pin
2374116-Jan-14 10:14
2374116-Jan-14 10:14 
GeneralRe: ShellExecuteEx with Windows 8 Pin
Member 147103916-Jan-14 14:33
Member 147103916-Jan-14 14:33 
GeneralRe: ShellExecuteEx with Windows 8 Pin
2374117-Jan-14 6:36
2374117-Jan-14 6:36 
GeneralRe: ShellExecuteEx with Windows 8 Pin
Member 147103917-Jan-14 9:03
Member 147103917-Jan-14 9:03 
GeneralRe: ShellExecuteEx with Windows 8 Pin
Member 147103918-Jan-14 11:25
Member 147103918-Jan-14 11:25 
QuestionRe: ShellExecuteEx with Windows 8 Pin
Richard MacCutchan16-Jan-14 22:05
mveRichard MacCutchan16-Jan-14 22:05 
AnswerRe: ShellExecuteEx with Windows 8 Pin
Member 147103917-Jan-14 8:11
Member 147103917-Jan-14 8:11 
QuestionHow to define a 3d array with each dimension a different type in C++? Pin
Falconapollo12-Jan-14 21:53
Falconapollo12-Jan-14 21:53 
AnswerRe: How to define a 3d array with each dimension a different type in C++? Pin
Richard MacCutchan12-Jan-14 22:46
mveRichard MacCutchan12-Jan-14 22:46 
GeneralRe: How to define a 3d array with each dimension a different type in C++? Pin
Albert Holguin13-Jan-14 4:09
professionalAlbert Holguin13-Jan-14 4:09 
GeneralRe: How to define a 3d array with each dimension a different type in C++? Pin
Richard MacCutchan13-Jan-14 5:06
mveRichard MacCutchan13-Jan-14 5:06 
GeneralRe: How to define a 3d array with each dimension a different type in C++? Pin
Stefan_Lang14-Jan-14 23:39
Stefan_Lang14-Jan-14 23:39 
GeneralRe: How to define a 3d array with each dimension a different type in C++? Pin
Richard MacCutchan15-Jan-14 0:36
mveRichard MacCutchan15-Jan-14 0:36 
AnswerRe: How to define a 3d array with each dimension a different type in C++? Pin
CPallini13-Jan-14 6:39
mveCPallini13-Jan-14 6:39 
AnswerRe: How to define a 3d array with each dimension a different type in C++? Pin
Stefan_Lang14-Jan-14 23:36
Stefan_Lang14-Jan-14 23:36 
GeneralRe: How to define a 3d array with each dimension a different type in C++? Pin
Richard Andrew x6416-Jan-14 11:56
professionalRichard Andrew x6416-Jan-14 11:56 
AnswerRe: How to define a 3d array with each dimension a different type in C++? Pin
Erudite_Eric15-Jan-14 0:11
Erudite_Eric15-Jan-14 0:11 

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.