2
當我嘗試部署代碼(win32智能手機項目)時,彈出註冊失敗錯誤並退出應用程序。但是,如果我將wc.lpszMenuName的右側更改爲NULL,則無需菜單即可正常工作。 win mobile 6不支持該功能嗎?Windows Mobile 6窗口註冊失敗
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc;
HWND hwnd;
MSG Msg;
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
wc.lpszClassName = g_szClassName;
if(!RegisterClass(&wc))
{
MessageBox(NULL, L"Window Registration Failed!", L"Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
// ...
}
調用['GetLastError'](http://msdn.microsoft.com/en-us/library/windows/desktop/ms679360%28v=vs.85%29.aspx)找出爲什麼'RegisterClass'失敗。 – Oswald