delphi - incompatible types pwidechar and string ShellExecute -
i try compress files using winrar command line, when add variable in command line these error incompatible types 'pwidechar' , 'string' !
i convert sdate variable widechar it's not work !!
how can fix !
procedure tform1.button1click(sender: tobject); var mydate : tdatetime; sdate : string; begin mydate:= now-7; sdate := formatdatetime('yyyy/mm/dd',mydate); shellexecute(0, 'open', pchar('c:\program files\winrar\winrar.exe'), 'a -r -ta'+ pchar(sdate) +' d:\xlsfiles.rar d:\*.xls*', nil, sw_show); end;
the text arguments of shellexecute of type pchar. supply string argument number 4.
the error message clear. know inspecting declaration of shellexecute problematic argument of type pchar (an alias pwidechar). , error message tells you passing string.
instead of
'a -r -ta'+ pchar(sdate) +' d:\xlsfiles.rar d:\*.xls*' pass
pchar('a -r -ta'+ sdate +' d:\xlsfiles.rar d:\*.xls*')
Comments
Post a Comment