SendMessageTimeoutW requires casting string to uint?

a11e99z black80 at bk.ru
Tue Jul 9 13:10:57 UTC 2019


On Tuesday, 9 July 2019 at 12:14:38 UTC, BoQsc wrote:
> On Tuesday, 9 July 2019 at 11:11:53 UTC, Dejan Lekic wrote:
>     auto result = SendMessageTimeoutW(
>         HWND_BROADCAST,
>         WM_SETTINGCHANGE,
>         0,
>         envi.toUTF16z,
>         SMTO_ABORTIFHUNG,
>         timeout,
>         null
>     );
>> C:\Users\User\Desktop>rdmd ref.d
>> ref.d(19): Error: function 
>> `core.sys.windows.winuser.SendMessageTimeoutW(void*, uint, 
>> uint, int, uint, uint, uint*)` is not callable using argument 
>> types `(void*, int, int, const(wchar)*, int, uint, 
>> typeof(null))`
>> ref.d(19):        cannot pass argument 
>> `toUTF16z(cast(const(char)[])envi)` of type `const(wchar)*` to 
>> parameter `int`
>> Failed: ["C:\\D\\dmd2\\windows\\bin\\dmd.exe", "-v", "-o-", 
>> "ref.d", "-I."]

// add cast to LPARAM for SendMessageTimeoutW
           cast( LPARAM )envi.toUTF16z,

// import lib too somewhere out of main() or in command line
version(Windows) pragma(lib, "user32.lib");


More information about the Digitalmars-d-learn mailing list