Archived

This topic is now archived and is closed to further replies.

dapeos

How come the compiler won't let me cast my DIMOUSESTAT to a void

Recommended Posts

dapeos    124
Please help DIMOUSESTATE MouseState; pMouse->GetDeviceState(sizeof(DIMOUSESTATE),(LPVOID) MouseState); what is wrong with this, everybook I have shows it this way here is the error: C:\visualStudioProjects\templates\cDInput.cpp(53) : error C2440: ''type cast'' : cannot convert from ''struct _DIMOUSESTATE'' to ''void *'' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Thanks in advance for your help -Dapeos

Share this post


Link to post
Share on other sites
Palidine    1315
try this:

pouse->GetDeviceState(sizeof(DIMOUSESTATE),(LPVOID) &MouseState);

you can't convert a non-pointer to a pointer. so put the little & thingy in front of your MouseState var like above and all should be fine. that gets the memory address of the MouseState var and casts that properly to a void*.

-me

[edited by - Palidine on March 28, 2004 3:27:20 PM]

Share this post


Link to post
Share on other sites