PAINTSTRUCT ps;
HWND hwnd;
GetDlgItem(hwnd, IDC_View);//
    HDC hdc = BeginPaint(hwnd,&ps);//
    DrawIcon(hdc,5,5,g_icon);
    EndPaint(hwnd,&ps);//错误如下:
E:\vc程序\FilePro\new.cpp(86) : error C2664: 'void __thiscall CWnd::GetDlgItem(int,struct HWND__ ** ) const' : cannot convert parameter 1 from 'struct HWND__ *' to 'int'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
E:\vc程序\FilePro\new.cpp(87) : error C2660: 'BeginPaint' : function does not take 2 parameters
E:\vc程序\FilePro\new.cpp(89) : error C2660: 'EndPaint' : function does not take 2 parameters
弄了很久不知道什么原因??

解决方案 »

  1.   

    GetDlgItem,那两个参数弄反了吧?应该是GetDlgItem(IDC_View,hwnd);
      

  2.   

    在MFC里面用SDK API要加上全局符号
    PAINTSTRUCT ps;
        HWND hwnd;
        ::GetDlgItem(hwnd, IDC_View);//
        HDC hdc = ::BeginPaint(hwnd,&ps);//
        ::DrawIcon(hdc,5,5,g_icon);
        ::EndPaint(hwnd,&ps);//
      

  3.   

    ??msdn上这样HWND GetDlgItem( 
      HWND hDlg, 
      int nIDDlgItem
    );   Parameters 
    hDlg 
    [in] Handle to the dialog box that contains the control. nIDDlgItem 
    [in] Specifies the identifier of the control to be retrieved. 
      

  4.   

    CEdit *p = (CEdit*)GetDlgItem(ID_EDIT);