toUTFz and WinAPI GetTextExtentPoint32W

Trass3r un at known.com
Tue Sep 20 11:34:49 PDT 2011


> Are you sure that the call requires the string to be null terminated? I  
> do not know that winapi function, but this might work:
>
> bool test(HDC dc, string str, SIZE* s)
> {
> auto wstr = to!(wchar[])str;
> GetTextExtentPoint32W(dc, wstr.ptr, wstr.length, s);
> ...

It doesn't need to be null-terminated for that function.
Shouldn't you use to!wstring though?!


More information about the Digitalmars-d-learn mailing list