Thread: Mouse Messages

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    27

    Mouse Messages

    I'm trying to find out wether the control button while a mouse click is down, I'll show you one way I tried. I'm using Standard API

    Code:
    case WM_LBUTTONDOWN:
    	if(wParam == MK_CONTROL)
    	{
    		hdc = GetDC(hwnd);
    		TextOut(hdc, 30, 30, "Mouse with Control", strlen("Mouse with Control"));
    		ReleaseDC(hwnd,hdc);
    	}
    	break;
    I've tried switch statements, google, etc.
    I'd appreciate any help, Thanks.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    wParam in this instance is a bit mask and will contain MK_CONTROL and MK_LBUTTON thus testing to see if wParam is equal to MK_CONTROL will fail. You need to test to see if wParam has MK_CONTROL set...
    Code:
    if(wParam == MK_CONTROL)
    ... should be...
    Code:
    if(wParam & MK_CONTROL)
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    27
    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Spy++ view messages posted/sent to a control, or from it?
    By hanhao in forum Windows Programming
    Replies: 2
    Last Post: 06-24-2007, 11:07 PM
  2. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  3. mouse messages, painting, tabs
    By ZeroG in forum Windows Programming
    Replies: 0
    Last Post: 06-20-2005, 03:51 AM
  4. erratic behavior with mouse messages
    By bennyandthejets in forum Windows Programming
    Replies: 2
    Last Post: 12-13-2002, 12:51 AM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM