# mouse problem

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

ok... this looks like the right forum for this i hope.. im making my program to work on my winXP computer. its going alright but i cant seem to work out mouse clicks in my program.. in the windows message loop my program picks up the mouse click but i cant get the x and y positions of the mouse. MSDN said that this code should do it.. xPos = GET_X_LPARAM(lParam); yPos = GET_Y_LPARAM(lParam); but i get this error: implicit declaration of function int GET_X_LPARAM(...)' implicit declaration of function int GET_Y_LPARAM(...)' now ive figured that this is because im not linking the appropriate library? if so then im stumped cause ive had trouble on librarys before.. how do i know what library to link? because i dont have a list of librarys anywhere and when i come across code like the above on sites like MSDN they dont say any specific library to link.. just that you use that code? so tho problems there.. does anyone know how to fix the mouse position problem? or anyone know how to fix my unknowingness of different librarys?

##### Share on other sites
The MSDN appears to be out of date on that one (at least I couldn't find the macros in any of the include files).

However, the MSDN also states that:

Quote:
 The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

So you can use the LOWORD and HIWORD macros instead. These are defined thus:

#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff))
#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))

##### Share on other sites
Did you #include <windowsx.h> ? That is where GET_X_LPARAM and GET_Y_LPARAM (they are macros, by the way) are defined.

1. 1
Rutin
37
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
633346
• Total Posts
3011451
• ### Who's Online (See full list)

There are no registered users currently online

×