写MFC程序很简单,界面很好处理。现在用SDK写,加个TOOLBar都有问题,唉,
我在WndProc里
case WM_CREATE:
InitToolBar();
break;
InitToolBar就是添加一个toolbar的
void InitToolBar()
{
HWND hToolBar;
hToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, (LPSTR) NULL, 
        WS_CHILD | CCS_ADJUSTABLE|TBSTYLE_EX_DRAWDDARROWS
|WS_BORDER  
, 0, 0, 0, 0, hWnd, 
        (HMENU) IDR_MYTOOLBAR, hInst, NULL);  int i = GetLastError();
}
CreateWindowEx老是不成功,i返回1406。 Error lookup说是 无法创建最上层子窗口。 
这个如何解决阿,请大家多多指教.

解决方案 »

  1.   

    代码应该没什么问题,你之前没有调用InitCommonControls吧?需要先调用一下这个函数的。
      

  2.   

    InitCommonControls如何用的啊?应该写在哪里?
      

  3.   

    用这个函数要包括哪些头文件啊?#include <commctrl.h>就这样好像还不行
      

  4.   

    Registers and initializes the common control window classes. This function is obsolete. New applications should use the InitCommonControlsEx function. 以上是msdn上的解释
    添加了头文件之后,还要在你的动态连接库里添加comctl32.lib文件