Private Const BM_CLICK As Long = &HF5

解决方案 »

  1.   

    http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=18140
      

  2.   

    只有wm_mousedown么?button的位置完全可以改变,随窗口缩放而变化,我如何能确定鼠标按下的坐标呢?
    可能我没有说清楚,button所在的窗口并非前台活动窗口,否则我点一下鼠标左键就完事了,何必送消息呢!
      

  3.   

    我安照&HF5写了一个程序,按钮没有任何反应!
    str1 = SendMessage(str, BM_CLICK, 0, 0)
    这里str为button的句柄,返回值为0,说明调用不成功!
      

  4.   

    Click事件 = WM_LBUTTONDOWN、WM_LBUTTONUP在lParam参数中决定点击位置(控件客户区坐标!)
    WM_LBUTTONDOWN
    The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. WM_LBUTTONDOWN 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
     
    Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. Res
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. QuickInfo
      Windows NT: Requires version 3.1 or later.
      Windows: Requires Windows 95 or later.
      Windows CE: Requires version 1.0 or later.
      Header: Declared in winuser.h.WM_LBUTTONUP
    The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. WM_LBUTTONUP 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
     
    Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. Res
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. QuickInfo
      Windows NT: Requires version 3.1 or later.
      Windows: Requires Windows 95 or later.
      Windows CE: Requires version 1.0 or later.
      Header: Declared in winuser.h.
      

  5.   

    不用给我wm_lbuttondown的说明。
    这个我明白。
    关键是窗口的botton按钮并不是固定在某个位置不动的,还有最小化的时候。
    鼠标点击方法不太合适。
      

  6.   

    就是这种情况下只能通过发wm_lbuttondown消息解决