PDA

View Full Version : How to use ShellExecute



Cer3brus
17-04-2009, 05:44 PM
After adding shellAPI to my uses, I used the Procedure:
ShellExecute(handle, 'open', Application.ExeName, nil, nil, sw_ShowNormal);
I get an error from Application.ExeName. It(the compiler) says "Incompatible types: 'String' and 'PAnsiChar'. Any ideas?

Wizard
17-04-2009, 06:09 PM
Application.exeName refers to the path of the exe you want to open. It's of type PChar and should be between ' '.

ShellExecute(handle, 'open', 'c:\windows\notepad.exe', nil, nil, sw_ShowNormal);

Hope this helps ;)

Dan
17-04-2009, 06:19 PM
just write PAnsiChar(Application.ExeName) that is assuming you have anything except D2009.

efilnukefesin
17-04-2009, 08:55 PM
shellexecute(handle, 'open', pchar(fn_prg2start), '', pchar(ExtractFileDir(fn_prg2start)), sw_normal);


for dos-boxes it's good to use 'sw_hide' so the window is hidden ;D