I am getting an error in my delphi code when using shellexecute to call an external progrem
procedure TReceiverMainForm.btnSearchClick(Sender: TObject);
var
args:string;
begin
mmoResult.Clear;
// args := ' /d=' + TIdURI.URLEncode(Trim(sSearch)) + ' /t=ReceiverMainForm /s=30 /m=1'
args := ' /q=' + httpencode(Trim(txtSearch.Text)) + ' /t=ReceiverMainForm /s='+Trim(txtS.Text)+' /m='+Trim(txtM.Text);
ShellExecute(Handle, 'open', 'YTD.exe', pWideChar(args), nil, SW_SHOWNORMAL);
end;
how do i reslve this error?
The
ShellExecutefunction is defined like soSo the issue is which you are casting the
argsvariable to aPWideCharinstead of aPChar.Try this code
Remember that Delphi 7 pre-dates the Unicode Delphi development. And so
PCharis an alias for the 8 bit character type,PAnsiChar.