Trying to compile a new application, I'm receiving this Error: Incompatible type for arg no. 1: Got "PWideChar", expected "PChar"
In this line:
procedure TForm1.FormCreate(Sender: TObject);
var
hFile: Thandle;
begin
{$DEFINE UNICODE}
hFile := Windows.CreateFile( PWideChar('\.\\c:\test.txt'),
GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL or FILE_FLAG_WRITE_THROUGH or FILE_FLAG_NO_BUFFERING, 0);
end
But I see that unidef.inc used by Windows.pas define the function, but is ascdef.inc version that appears in code completion.
Anyway, if I use Windows.CreateFileW instead, the error disappear.
Just wanted to know why.