我在用EnumChildWindows(wnd,EnumWindowsProc,(LPARAM)0);编译时老是出错:
--------------------Configuration: bb - Win32 Debug--------------------
Compiling...
bbView.cpp
E:\Program Files\Microsoft Visual Studio\MyProjects\bb\bbView.cpp(111) : error C2664: 'EnumChildWindows' : cannot convert parameter 2 from 'int' to 'int (__stdcall *)(struct HWND__ *,long)'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
Creating browse info file...bb.exe - 1 error(s), 0 warning(s)
//
BOOL CALLBACK EnumChildProcq(
  HWND hwnd,      // handle to child window
  LPARAM lParam   // application-defined value
)
{
return true;
}

解决方案 »

  1.   

    int __stdcall EnumChildProcq(
      HWND *hwnd,      // handle to child window
     long lParam   // application-defined value
    )
    {
    return true;
    }你声明的函数类型不对啊,按照要求声明看看
      

  2.   

    应该是你函数调用的第二个参数不匹配,
    BOOL CALLBACK EnumChildProcq(   //---------->BOOL CALLBACK EnumChildProc( 
      HWND hwnd,      // handle to child window
      LPARAM lParam   // application-defined value
    )
    {
    return true;
    }
      

  3.   

    EnumChildWindows(wnd, @EnumWindowsProc,(LPARAM)0);
      

  4.   

    cnwolf(独狼), dfyang() 和我现在的有什么不同?我看不出来
      

  5.   

    如果我把BOOL CALLBACK EnumChildProcq设置为静态的就可以了 不知道为什么
      

  6.   

    struct HWND__ *,是指针,你的不是
      

  7.   

    BOOL CALLBACK EnumChildProcq(
      HWND hwnd,      // handle to child window
      LPARAM lParam   // application-defined value
    )
    {
    return true;
    } 这样写应该是全局函数啦 全局函数不能随便写到一个。cpp那里的吗?