Thread: console app
View Single Post
  #2  
Old 07-21-2011, 09:12 PM
arwar arwar is offline
Member
 
Join Date: May 2010
Posts: 31
Default

i figured out a solution myself. what was hanging me up was that i couldn't get shellexecute past the compiler. it didn't like the handle argument and i don't where it is defined in Delphi to add the unit to uses clause.

here is the code:

program up_it;
{$APPTYPE CONSOLE}
uses
SysUtils, shellapi, windows, dialogs;

begin

sleep(500);
if fileexists('test.exe') then begin
deletefile('sao.exe');
renamefile('test.exe','sao.exe');
shellexecute(0,'open',pansichar('sao.exe'),nil,nil ,sw_shownormal);
end
else showmessage('no file test.exe found');
end.

i changed the first param in shellexecute from 'handle' to '0' and off it went. anybody have anything else to add?
Reply With Quote