I am reading through the pages of "Programming Windows, fifth edition" by Charles Petzold. I use Dev_c++ complier. I created a windows application and it created most of the basic windows stuff I wanted. Looking trhough the pages I saw an example program that creates a window and the text Hello Windows 98! is printed to the center of the created window. The code for it to do that is:
That is not exactly letter for letter I added a few things that Dev didn't have included...mainly the WM_PAINT stuff. But anyways that is what I have and I am getting an error message.Code:LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; RECT rect; switch (message) /* handle the messages */ { case WM_PAINT: hdc = BeginPaint (hwnd, &ps); GetClientRect (hwnd, &rect); DrawText (hdc, TEXT("Hello!!!!!"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); EndPaint (hwnd, &ps); return 0; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); }
Why isn't this working, what did I do wrong?Code:Permission denied Id returned 1 exit status [Build error] [Project1.exe] Error 1



LinkBack URL
About LinkBacks


