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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -