How come the compiler won't let me cast my DIMOUSESTAT to a void
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
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement