ShellExecute not working from IDE but works otherwise.

Posted by Altar on Stack Overflow See other posts from Stack Overflow or by Altar
Published on 2010-06-15T19:02:31Z Indexed on 2010/06/15 19:52 UTC
Read the original article Hit count: 276

Filed under:

I want to create and then open a txt file using the ShellExecute command.

I have used this code for years with Delphi 7 and it worked:

function Executa(CONST ExeName, Parameters: string): Boolean;
begin
 if Parameters= ''
 then Result:= ShellExecute(0, 'open', PChar(ExeName), NIL              , nil, SW_SHOWNORMAL)> 32
 else Result:= ShellExecute(0, 'open', PChar(ExeName), PChar(Parameters), nil, SW_SHOWNORMAL)> 32;
end;

Now, I switch to Windows 7 (don't like it; they stuck it on my throat with my new laptop) 64 bit and the code is not working anymore when it runs from IDE. Delhi shows the CPU window with the caption "CPU-Process unknown (2352)". I close the CU windows and everything works fine until I close the application, when Delphi shows the CPU window one more time. If I run the app from outside IDE, it works fine.

Looks like the debugger has something to say to me, but I don't know what.

© Stack Overflow or respective owner

Related posts about delphi