Currently I am detecting the x and y position of a mouse click, storing it in a Point and displaying it through the message box.
I want to be able to read if another keyboard key is being held down such as the Shift or Control button.
Looking on MSDN I found the following information:
wParam Indicates whether various virtual keys are down. This parameter can be one or more of the following values.
MK_CONTROL The CTRL key is down.
MK_MBUTTON The middle mouse button is down.
MK_RBUTTON The right mouse button is down.
MK_SHIFT The SHIFT key is down.
MK_XBUTTON1 Windows 2000/XP: The first X button is down.
MK_XBUTTON2 Windows 2000/XP: The second X button is down.
The problem I am having is I'm unsure as to how to store the results from wParam for each parameter and use them like I have to display them through the message box.
Here is my progress so far:
LRESULT CALLBACK WindowFunc(HWND hMainWindow, UINT message,
WPARAM wParam, LPARAM lParam)
{
POINTS mouseXY;
WCHAR buffer[256];
// Act on current message
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_LBUTTONUP:
// Get mouse x, y
mouseXY = MAKEPOINTS(lParam);
// Output the co-ordinates
swprintf(buffer, 255, L"x = %d, y = %d", mouseXY.x, mouseXY.y);
MessageBox(0, buffer, L"Mouse Position", MB_OK);
break;
default:
return DefWindowProc(hMainWindow, message, wParam, lParam);
}
return 0;
}
Thanks for the help