--- q_a/samples/semaphor/sema.c 2018/08/09 18:29:19 1.1 +++ q_a/samples/semaphor/sema.c 2018/08/09 18:29:42 1.1.1.2 @@ -120,7 +120,7 @@ int APIENTRY WinMain (HANDLE hInstance, ShowWindow(hWnd, nCmdShow); - while (GetMessage (&msg, NULL, NULL, NULL)) + while (GetMessage (&msg, NULL, 0, 0)) DispatchMessage (&msg); // Dispatch message to window. return (msg.wParam); // Returns value from PostQuitMessage. @@ -265,28 +265,28 @@ LONG APIENTRY MainWndProc (HWND hwnd, *pColor1 = GREEN; // Create the Green thread. hThread1 = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, - (LPVOID)pColor1, NULL, + (LPVOID)pColor1, 0, (LPDWORD)&ThreadID1); pColor2 = malloc(sizeof(DWORD)); *pColor2 = RED; // Create the Red thread. hThread2 = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, - (LPVOID)pColor2, NULL, + (LPVOID)pColor2, 0, (LPDWORD)&ThreadID2); pColor3 = malloc(sizeof(DWORD)); *pColor3 = BLUE; // Create the Blue thread. hThread3 = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, - (LPVOID)pColor3, NULL, + (LPVOID)pColor3, 0, (LPDWORD)&ThreadID3); pColor4 = malloc(sizeof(DWORD)); *pColor4 = GRAY; // Create the Gray thread. hThread4 = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, - (LPVOID)pColor4, NULL, + (LPVOID)pColor4, 0, (LPDWORD)&ThreadID4); ReleaseSemaphore (hSemaphore, 1, NULL); @@ -364,7 +364,6 @@ VOID ThreadProc ( LPVOID *Color) hDC = GetDC(hWnd); SelectObject( hDC, hBrush); Rectangle (hDC, Col, Row, Col + width, Row + height); - DeleteObject (hBrush); ReleaseDC(hWnd, hDC); Sleep (500); ReleaseSemaphore (hSemaphore, 1, NULL);