What's going on with this code?
-
Hi My own code is a dll includes dialog box,written based on Win32 API(For WinCE). I plan to attached a command bar when Dialog shown,but it doesn't work. Why SHCreateMenuBar(&mbi) always return a NULL? HINSTANCE hInst=NULL; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { hInst = (HINSTANCE) hModule; return TRUE; } HWND MyCreateRpCommandBar(HWND hwnd) { SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hwnd; //HWND of dialog mbi.nToolBarId = IDR_SIV_MENUBAR; mbi.hInstRes = hInst; //HINSTANCE of dll mbi.nBmpId = 0; mbi.cBmpImages = 0; if (!SHCreateMenuBar(&mbi)) //Command bar was dead here!!! return NULL; return mbi.hwndMB; } BOOL CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static HWND hwndCB=NULL; switch (message) { case WM_INITDIALOG: hwndCB=MyCreateRpCommandBar(hDlg); return TRUE; case WM_DESTROY: CommandBar_Destroy(hwndCB); return TRUE; } return FALSE; } Please mail to sonicjet@pchome.com.tw ,if you have any recommend.