Converting a Variable from a BTYE type to a WORD type

First post on so apologies if this has been answered else-ware (I couldn't find any answers I understood/applied to me) or if this question is in the wrong forum.

I'm working with DirectX and playing around with Xbox 360 controller inputs (in a windows environment) and trying to use the returned trigger values of the controller to set the vibration frequency of the controller.

I have a function that gets/reads the Trigger value of the controller and that returns a BYTE type (0-255)

And I have another function that vibrates the controller.

My problem is that the function that vibrates the controller accepts a WORD type (0-65535) as its argument so I need to convert the BYTE (0xFF) to a WORD (0xFF00) type and am stuck at how to do it.

I roughly know what the two types are, but don't have much experience in windows programming so don't know how to convert them. I tried a static_cast but that didn't seem to work...

Any help/advice would be greatly appreciated.

Maybe somewhere in Windows headesr there is a special macro that shifts a BYTE left. But in any case you should shift the BYTE left.
Last edited on

This thread seems to cover the options pretty well.
Thanks guys.

The MAKEWORD macro worked really well (after I worked out to use 0 as a second BYTE and which order to put them in)

Once again, Thanks.
Topic archived. No new replies allowed.