Mouse Messages

This is a discussion on Mouse Messages within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to find out wether the control button while a mouse click is down, I'll show you one way ...

  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,831
    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-25-2007, 12:07 AM
  2. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 08:07 AM
  3. mouse messages, painting, tabs
    By ZeroG in forum Windows Programming
    Replies: 0
    Last Post: 06-20-2005, 04: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, 04:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21