|
I handle the WM_CREATE message in the window procedure of my program like this:
case WM_CREATE:
desktop = GetDesktopWindow ();
oldPROC = (WNDPROC) SetWindowLon (desktop, GWL_WNDPROC, (LONG) myProc);
return 0;
Then myProc:
LRESULT CALLBACK myProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message)
{
case WM_KEYDOWN:
hdc = GetDC (hWnd);
RECT rt;
GetClientRect (hWnd,&rt);
DrawText (hdc, TEXT ("HELLO"), 5,&rt, DT_CENTER);
ReleaseDC (hWnd, hdc);
InvalidateRect (hWnd, NULL, TRUE);
return 0;
}
return CallWindowProc (WndProc, hWnd, message, wParam, lParam);
}
After I run the program, when the desktop is the input focus, I can't get "Hello" by clicking any key. Why?
Also, I have just started to learn win32 programming recently. When I was looking at windows programming, I felt that there are too many WIN32 API functions, and many things are a little bit ignorant. I hope that experts will recommend some good learning methods or good books for me. . . |
|