Unicode problems with Delphi 2009 / 2010 and windows API calls
- by Charles Faiga
Hi I have been using this function in Delphi 2006, but now with D2010 it throws an error.
I think it is related to the switch to Unicode.
Function TWinUtils.GetTempFile(Const Extension: STRING): STRING;
Var
Buffer: ARRAY [0 .. MAX_PATH] OF char;
Begin
Repeat
GetTempPath(SizeOf(Buffer) - 1, Buffer);
GetTempFileName(Buffer, '~~', 0, Buffer);
Result := ChangeFileExt(Buffer, Extension);
Until not FileExists(Result);
End;
What should I do to make it work?
EDIT
I get an 'access violation' when the ChangeFileExt is called