我在用VC6.0编程时发现了一个问题,举例子来说:
对于GetDlgItemInt这个API函数来说,有四个参数
UINT GetDlgItemInt(
    HWND hDlg, // handle to dialog box
    int nIDDlgItem, // control identifier
    BOOL *lpTranslated, // points to variable to receive success/failure indicator
    BOOL bSigned  // specifies whether value is signed or unsigned
   );
而有时编程,只用GetDlgItemInt(IDC_EDIT1)即可。
这是怎么回事呢?而有时用GetDlgItemInt(IDC_EDIT1)却不行。
到底该何时用何种呢?

解决方案 »

  1.   

    在CWnd的子类中可以使用一个参数
    CWnd::GetDlgItemInt  
    UINT GetDlgItemInt( int nID, BOOL* lpTrans = NULL, BOOL bSigned = TRUE ) const;
    在CWindow的子类中也是
    CWindow::GetDlgItemInt
    UINT GetDlgItemInt( int nID, BOOL* lpTrans = NULL, BOOL bSigned = TRUE ) const;
      

  2.   

    是mfc 和window32的区别吧!
      

  3.   

    这有什么怎么办,不同环境用不同函数,在CWnd上下文(类里面)就用CWnd的成员函数,在CWnd类外面就用API函数,在类里面调用外部API函数就用::全局作用域修饰符。
      

  4.   

    函数作用域不同,很容易区分。
    ::表示API函数,需要把形参带齐;不带::表示MFC库函数,只要带上控件ID就行了。