I have a listbox with one item 'ABC'.
The following code works fine under Win32:
h := DrawText(ListBox1.Canvas.Handle, PChar(ListBox1.Items[0]), -1, R, DT_CALCRECT);
After that line h = 19
, which is correct.
Using the same code under Win64 returns 0, e.g. h = 0
SysErrorMessage(GetLastError) returns "The operation completed successfully"
Now if I modify the code this way, it works both on Win32 and Win64.
s := ListBox1.Items[0];
h := DrawText(ListBox1.Canvas.Handle, PChar(s), -1, R, DT_CALCRECT);
After this change h = 19
on Win32 and Win64. Any ideas why a temporary variable is needed under Win64?