Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3027

Accepting input messages and distributing them to children of a desktop window?

$
0
0
Hello,
I created a WS_POPUP window that occupied the whole screen and stuck an explorer into it.
But in the message loop, why when I don't handle any messages at all,
I pass it to DefWindowProc, does it mean it handles inputs for me automatically.
In the test below, it seems I have to handle the mouse/keyboard messages on my own....
Is there a quick way I can support all of the messages a desktop window needs, just everything including
WM_THEMECHANGED, WM_SYSCOLORCHANGED etc..
Code:

LRESULT CALLBACK MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
                                 
        PAINTSTRUCT ps;               
        HDC hdc;

        switch(msg)
        {       
                case WM_PAINT:                       
                        hdc = BeginPaint(hwnd, &ps);                       
                        // Paint the wallpaper here
                        //PaintDesktop(hdc);

                        EndPaint(hwnd, &ps);
                        return 0;
                case WM_HOTKEY:                       
                        switch(wParam)
                        {
                        case 1:
                                printf("Switching to Desktop 1\n");
                                SetThreadDesktop(_original_desktop);
                                SwitchDesktop(_original_desktop);
                                break;
                        case 2:
                                printf("Switching to Desktop 2\n");
                                SetThreadDesktop(_hidden_desktop);
                                SwitchDesktop(_hidden_desktop);
                                break;
                        case 4:
                                printf("Exiting\n");
                                break;
                       
                        }
                       
                        break;
                case WM_DESTROY:
                        PostQuitMessage(0);
                        break;
                               
                default:
                        break;

        }
       

        return DefWindowProc(hwnd, msg, wParam, lParam);
}


Viewing all articles
Browse latest Browse all 3027

Latest Images

Trending Articles



Latest Images