Link to home
Start Free TrialLog in
Avatar of profitsource
profitsource

asked on

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.

Thanks
Lee Mc Cauley
 
Avatar of systan
systan
Flag of Philippines image

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
Avatar of profitsource
profitsource

ASKER

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.

Lee
Thommy;

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.

Lee
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.
ASKER CERTIFIED SOLUTION
Avatar of profitsource
profitsource

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yee
good that you replaced
from
if ShellExecute(0, OPEN,
to
if ShellExecute(0, nil,

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