在父窗口的WM_COMMAND消息事件中有如下代码:
SendMessage(hwndButton[2],BM_SETCHECK,NULL,NULL);
//其中hwndButton[2] 子窗口风格是 BS_CHECKBOX
任凭你怎么点这个checkbox,前面的圆点始终出不来呢?

解决方案 »

  1.   

    SendMessage( hwndButton[2], BM_SETCHECK, 1,0L );
      

  2.   

    真是奇怪,怎么加上后面两个参数就可以选中了?
    msdn里面有说的吗?请问楼上的大哥您从哪里得知的?
      

  3.   

    BM_SETCHECK
    An application sends a BM_SETCHECK message to set the check state of a radio button or check box. To send this message, call the SendMessage function with the following parameters. SendMessage( 
      (HWND) hWnd,        // handle to destination window 
      BM_SETCHECK,        // message to send
      (WPARAM) wParam,    // check state
      (LPARAM) lParam     // not used; must be zero
    );
    Parameters
    wParam 
    Specifies the check state. This parameter can be one of the following values. Value Meaning 
    BST_CHECKED Sets the button state to checked. 
    BST_INDETERMINATE Sets the button state to grayed, indicating an indeterminate state. Use this value only if the button has the BS_3STATE or BS_AUTO3STATE style. 
    BST_UNCHECKED Sets the button state to cleared. 
    lParam 
    This parameter is not used. 
    Return Values
    This message always returns zero. 
      

  4.   

    为了程序的可读性,用BST_CHECKED 代替比较好