probleme beim beenden des programmes
-
moin,
meine programme beenden sich seit kurzem nicht mehr richtig, ich kann aber keinen fehler entdecken. der ganze pc bleibt immer stecken, wenn ich die fenster zumache, dann darf ich erst wieder den taskmanager aufmachen, am ende ein <programmname> [reagiert nicht] beenden und mich ärgern.
ich habe jetzt mal eine sehr abgespeckte version ausprobiert - immer der gleiche fehler.
p.s.: bisher hat es eigentlcih auch geklappt
#include <windows.h> #include <stdio.h> #include <stdlib.h> //--------------------------------------------------------- //defines: #ifndef NULL #define NULL (void*)0 #endif #ifndef STRICT #define STRICT #endif //--------------------------------------------------------- //global variables: const char szAppName[] = "PlayChess"; //--------------------------------------------------------- //funktions: LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); //--------------------------------------------------------- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) { HWND hWnd; WNDCLASS wc; MSG msg; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hInstance = hInstance; wc.lpfnWndProc = WndProc; wc.lpszClassName = szAppName; wc.lpszMenuName = NULL; wc.style = CS_HREDRAW | CS_VREDRAW; RegisterClass(&wc); hWnd = CreateWindow(szAppName, szAppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow(hWnd, iCmdShow); UpdateWindow(hWnd); while(GetMessage(&msg, hWnd, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } //--------------------------------------------------------- LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); return(0); } } return DefWindowProc(hWnd, message, wParam, lParam); }euer ItsNotYou
-
Hi, I'm Dutch and my german is not really good so an answer in english ;-).
Try to change the GetMessage parameter HWND into NULL.
-
thanks
-
This parameter is for other windows so you can receive also messages from other windows, i'm not totally sure how to do this but I know where the parameter stands for and thats enough
