Friday 15 February 2013

c++ - Dialog boxes are not created WinAPI -


If I create a hair window in the main window ("About" the window in this case), then for some reason The dialog box is not called if you do not, then the hair window is a normal dialog box and works fine. GetLastError returns error number 1812 (there was no resource section in the specified image file.) But everything is fine with a resource file. And as I said, if you do not make any hair window then everything works fine. What is the problem?

  #include & lt; Windows.h & gt; #include "resource.h" long WINAPI WndProc (HWND, UINT, WPARAM, LPARAM); About INT_PTR Callback (HDND HDLG, UINT Message, VARAM VARAM, LAPRM ElParam); LRESULT Callback Points PRC (HWND H Points, UINT Message, VARAM VARAM, LAPRM LPRAM); HISTANSHINEST; HW & H points; Integer WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, integer nCmdShow) {hInst = hInstance; Hwd; hwd; MSG msg; WNDCLASS w; Memset (-sym, 0, sizeof (WNDCLASS)); W. Style = cs_HRERArade | CS_VREDRAW; W.lpfnWndProc = WndProc; W.hInstance = hInstance; W.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); W.lpszClassName = L "My Class"; RegisterClass (-sym); Hwnd = CreateWindow (el "my class", l "my title", WS_OVERLAPPEDWINDOW, 300, 200, 200, 180, zero, zero, hInstance, zero); HMENU main_menu = Create menu (); AppendMenu (main_menu, MF_string, 1111, L "box"); WNDCLASS w2; Memset (&; 2, 0, size (WNDCLASS)); W2.lpfnWndProc = (WNDPROC) Points Percent; W2.hInstance = hInst; W2.lpszClassName = "About"; W2.hcursor = Loaders (NULL, IDC_ARROW); W2.hbrBackground = (HBRUSH) CreateSolidBrush (RGB (111, 111, 111)); RegisterClass (& amp; W2); HPoints = CreateWindowEx (0, about "L", (LPCTSTR) zero, WS_CHILD | WS_BORDER | WS_VISIBLE | WS_DISABLED, 10, 10, 100, 100, hwnd, (HMENU) 1112, hInst, zero); ShowWindow (hPoints, SW_NORMAL); UpdateWindow (hPoints); Set menu (hwnd, men_menu); ShowWindow (hWnd, nCmdShow); UpdateWindow (hwnd); While (GetMessage (& msg, NULL, 0,0)) {TranslateMessage (& amp; msg); DispatchMessage (& amp; msg); } Return msg.wParam; } Long WINAPI WndProc (HWND hwnd, uint message, wParam wParam, lParam lParam) {Switch (Message) {Case WM_COMMAND: Switch (LOWORD (wParam)) {Case 1111: About DialogBox (hInst, MAKEINTRESOURCE (IDD_DIALOG1), hwnd In) ; Return 0; } break; Case WM_DESTROY: PostQuitMessage (0); break; Default: Return DefWindowProc (hwnd, message, wparam, lparam); } Return 0; } LRESULT Callback PointsProc (HWND hPoints, uint message, wParam wParam, lParam lParam) {switch (message) {case WM_DESTROY: PostQuitMessage (0); break; Case WM_PAINT: Break; Default: Return DefWindowProc (hPoints, Message, wParam, lParam); } Return 0; } INT_PTR about callback (HDND HDLG, UINT messaging, VARAM use, LAPRM LPARM) {UNREFERENCED_PARAMETER (lParam); Switch (message) {case WM_INITDIALOG: return (INT_PTR) TRUE; Case WM_COMMAND: If (Loword (WPARM) == IDCNNEL) {AndDiLog (HDLG, Loward (WPARAM)); Return (INT_PTR) TRUE; } break; } Return (INT_PTR) incorrect; }   

dialog box , which is called only Due to a long time pointpoint () is being looping ...

problem break; while WM_PAINT PointsProc () -. If it leaves the call then DefWindowProc () , so get the window WM_PAINT message because the window remains illegal

  // case WM_PAINT: // break;    

No comments:

Post a Comment