bok
2013-10-21 08:58:40 UTC
The code below is PURPOSELY written badly only to facilitate brevity, so don't
comment on it. What I AM venting about is the fact that what makes this code work in XE is that you have to send a pchar to Runit, but declare that what Runit is receiving is a string.
Yes; I know it is a Unicode thing!
Yes;I know that there are probably workarounds!
MY point is that this is crazy!!! I shouldn't have to "roll my own" solution
to so basic a task.
Do you know why Delphi never kicked VB or C in the ass? Two reasons: poor documentation and this kind of bullshit!!
Just my two cents
Thanks
/////////////////////////////////////////////////////
Procedure runit(Exe:string);
var
Si:TStartupInfo;
Pi:TProcessInformation;
begin
FillChar(Si,SizeOf(TStartupInfo),#0);
FillChar(Pi,SizeOf(TProcessInformation),#0);
Si.cb := SizeOf(TStartupInfo);
CreateProcess(nil,PChar(Exe),nil,nil,False,1049152,nil,nil,Si,Pi);
end;
procedure TForm1.Button1Click(Sender:TObject);
begin
runit(pchar('C:\Windows\Notepad.EXE'));
end;
comment on it. What I AM venting about is the fact that what makes this code work in XE is that you have to send a pchar to Runit, but declare that what Runit is receiving is a string.
Yes; I know it is a Unicode thing!
Yes;I know that there are probably workarounds!
MY point is that this is crazy!!! I shouldn't have to "roll my own" solution
to so basic a task.
Do you know why Delphi never kicked VB or C in the ass? Two reasons: poor documentation and this kind of bullshit!!
Just my two cents
Thanks
/////////////////////////////////////////////////////
Procedure runit(Exe:string);
var
Si:TStartupInfo;
Pi:TProcessInformation;
begin
FillChar(Si,SizeOf(TStartupInfo),#0);
FillChar(Pi,SizeOf(TProcessInformation),#0);
Si.cb := SizeOf(TStartupInfo);
CreateProcess(nil,PChar(Exe),nil,nil,False,1049152,nil,nil,Si,Pi);
end;
procedure TForm1.Button1Click(Sender:TObject);
begin
runit(pchar('C:\Windows\Notepad.EXE'));
end;