用 EDIT 和 SPIN 控件组合来输入数字,但数子每三位都会用 , 分割,请问如何去掉这个 , ??
还有要禁用控件时向控件发送  WM_ENABLE 消息时 lParam 和 wParam 该如何设置?

解决方案 »

  1.   

    SPIN控件有个属性叫做No thousands,选上后应该不会有逗号分割了。
      

  2.   

    WM_ENABLE这个消息是窗口被禁用后发出的,不是用来禁用控件。
    禁用控件用下面这个函数
    CWnd::EnableWindow  
    BOOL EnableWindow( BOOL bEnable = TRUE );
    Return Value
    Indicates the state before the EnableWindow member function was called. The return value is nonzero if the window was previously disabled. The return value is 0 if the window was previously enabled or an error occurred.
    Parameters
    bEnable
    Specifies whether the given window is to be enabled or disabled. If this parameter is TRUE, the window will be enabled. If this parameter is FALSE, the window will be disabled.
      

  3.   

    CWnd *pWnd = (CWnd*)GetDlgItem(ID);
    pWnd->EnableWindow(FALSE);
    就可以了
      

  4.   

    但是在不能使用 MFC 的 CWnd 类的情况下如何禁用呢?
      

  5.   

    跟MFC的函数名一样,只不过加一个窗口句柄参数而已EnableWindow
    The EnableWindow function enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input. BOOL EnableWindow(
      HWND hWnd,     // handle to window
      BOOL bEnable   // flag for enabling or disabling input
    );
     
    Parameters
    hWnd 
    Handle to the window to be enabled or disabled. 
    bEnable 
    Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.