SendMessageTimeoutW requires casting string to uint?

Dejan Lekic dejan.lekic at gmail.com
Tue Jul 9 11:06:54 UTC 2019


On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote:
> I'm quite new to the programming, and I'm getting unsure how to 
> make SendMessageTimeoutW to work with D lang.
>
> Most of my attention right now resides around the Argument of 
> the SendMessageTimeoutW function:
>> "Environment",
>
> It seems that SendMessageTimeoutW  accepts only uint type, and 
> string can't be directly used.
>
> I think that I have to convert string characters to "C-style 0 
> terminated string".
> And everything should work? But I'm unsure how to do that.
>
>
> All I know that there was toString16z function from tango 
> project, that made it all work.
> 

std.utf module has all encoding/decoding you need (in this case 
UTF-16). I guess You need to convert your string using toUTF16 ( 
https://dlang.org/phobos/std_utf.html#toUTF16 ). I do not do 
Windows programming so I am not 100% sure whether this will work 
or not. Give it a try.


More information about the Digitalmars-d-learn mailing list