CreateWindow也有一个Ex的版本,有什么区别呀???

解决方案 »

  1.   

    据我所知RegisterClassEx 好像是对RegisterClass进行了封装,也就是前者的实现调用了后者。
    CreateWindowEx也就是比CreateWindow多了一个参数,用来定义窗口的特别样式。
      

  2.   

    好象楼上的说反了,RegisterClass的实现调用了RegisterClassEx
      

  3.   

    两个函数声明如下:
    ATOM RegisterClassEx(
      CONST WNDCLASSEX *lpwcx  // address of structure with class data
    );
    其中WNDCLASSEX声明如下:
    typedef struct _WNDCLASSEX { 
        UINT    cbSize; 
        UINT    style; 
        WNDPROC lpfnWndProc; 
        int     cbClsExtra; 
        int     cbWndExtra; 
        HANDLE  hInstance; 
        HICON   hIcon; 
        HCURSOR hCursor; 
        HBRUSH  hbrBackground; 
        LPCTSTR lpszMenuName; 
        LPCTSTR lpszClassName; 
        HICON   hIconSm; 
    } WNDCLASSEX; 
     
    ///////////////////////////////
    ATOM RegisterClass(
      CONST WNDCLASS *lpWndClass   // address of structure with class 
                                   // data
    );
    其中WNDCLASS声明如下:
    typedef struct _WNDCLASS { 
        UINT    style; 
        WNDPROC lpfnWndProc; 
        int     cbClsExtra; 
        int     cbWndExtra; 
        HANDLE  hInstance; 
        HICON   hIcon; 
        HCURSOR hCursor; 
        HBRUSH  hbrBackground; 
        LPCTSTR lpszMenuName; 
        LPCTSTR lpszClassName; 
    } WNDCLASS;
      

  4.   

    我觉得RegisterClass好用一些,因为在显示大图标和小图标时不用自己管的
      

  5.   

    RegisterClassEx是为了使用WNDCLASSEX,WNDCLASSEX比WNDCLASS只多了一个元素(hIconSm),用于指定窗口的小图标(否则系统自动把hIcon指定的图标缩放成小图标,可能有失真)