Problem with shellexecute and Delphi XE

The following code worked fine in Delphi 2010.  I recently moved to Delphi XE. I am attempting to launch another application from within a Delphi app.

      if ShellExecute(0, nil, PChar('c:\temp\newapp.exe), nil, nil, SW_SHOW) <= 32 then
           Application.MessageBox('Couldn''t execute the application',
                                  'Error', MB_ICONEXCLAMATION);

This will return an error that says"The program or feature "\??\c:\temp\newapp.exe" cannot start or run due to incompatibility with 64 bit version of Windows.

The error message comes up because the PChar typecast is placing "\??\" in front of the string "c:\temp\newapp.exe".

I believe it may be something in Delphi XE that I must turn off or turn on, but I have no idea.

I can duplicate this problem in a simple app everytime using ShellExecute.  

Who can help me?  I am running a 64-bit machine with Windows 7.

Lee Mc Cauley
Who is Participating?
profitsourceAuthor Commented:
Problem has been solved.  I am sorry for wasting anyone's time. The problem was with a corrupted file that I was attempted to execute.

Thank you,
You have forgotten the second inverted comma for your app string...

ShellExecute(0, nil, PChar('c:\temp\newapp.exe'), nil, nil, SW_SHOW) <= 32 then
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

profitsourceAuthor Commented:
I don't see how your answer has anything to do with the problem I am having.

Besides, one of the links you sent me was in German.

profitsourceAuthor Commented:

My previous comment was for systan.

That was a typo on my part when submitting this question.  In my app, it is there.

If I would not have it in my app, it wouldn't even compile. So that is not the issue.

I'm not German, sorry for the link, but I think you have the idea now, to wOwdisable if executing 32b from 64b app.

I know you understand the function.
good that you replaced
if ShellExecute(0, OPEN,
if ShellExecute(0, nil,

corrupted file?
that's the number one reason the file would not ran
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.