Advertisement

Mouse Problem

Started by September 25, 2002 05:24 PM
1 comment, last by xiros 21 years, 11 months ago
I am trying to use typedef struct tagMOUSEINPUT from winuser.h for my program but I cant figure out how to use it. I cant create a variable of that type (eg. tagMOUSEINPUT Mouse. Am I missing a library or header? or am I trying to use it wrong? BTW, Like it says on MSDN, I am also including windows.h.
In order to use the struct tagMOUSEINPUT you need to create an instance like this.

MOUSEINPUT MyMouseInput;

Just remove the tag. That should work. The tag on the beginning just means that they want to give the struct a name but want to typedef it to something else. So they use tag on the beginning and then use typedef. If you looked in MSDN you'll see that the struct is actually

typedef struct tagMOUSEINPUT
{
//vars
}MOUSEINPUT,FAR *MOUSEINPUT;

By using typedef they are saying that MOUSEINPUT means struct tagMOUSEINPUT. But doesn't neccesarily mean you can use struct tagMOUSEINPUT.




From a FLOOP (Freak of Object Oriented Programming)

[edited by - RamboBones on September 25, 2002 6:35:16 PM]
Advertisement
It gives me three errors when I try that too. Without that line my code compiles fine.

syntax error : missing '';'' before identifier ''MyMouseInput''
error C2501: ''MOUSEINPUT'' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found

This topic is closed to new replies.

Advertisement