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('Co uldn''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
if ShellExecute(0, nil, PChar('c:\temp\newapp.exe)
Application.MessageBox('Co
'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
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
ShellExecute(0, nil, PChar('c:\temp\newapp.exe'), nil, nil, SW_SHOW) <= 32 then
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
Besides, one of the links you sent me was in German.
Lee
ASKER
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
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.
I know you understand the function.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
http://msdn.microsoft.com/en-us/library/aa365743.aspx
https://forums.embarcadero.com/thread.jspa?threadID=33584
http://www.delphipraxis.net/607996-post11.html