Thread: Wm_paint

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    60

    Wm_paint

    static int i=0;
    switch(message){
    case WM_PAINT:
    ...
    if(i<255) i++;
    else if(i==255) i=0;
    SetTextColor(devcont,RGB(i,127,127)); // handledevicecontext
    DrawText(devcont,"Hello World",-1,&area,DT_CENTER);

    ...

    QUESTION: How can I feed my WindowsProcedure with
    new WM_PAINT messages. I've heard UpdateWindow
    sends WM_PAINT messages to a window. Where must I
    place UpdateWindow? Inside the message loop?
    (I'm a beginner in Windows programming)

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    You could place UpdateWindow() when you want the window to be repainted, but after the window has been initially drawn it's more conventional to call the InvalidateRect() function. UpdateWindow() bypasses your app's message queue whereas InvalidateRect() forces a WM_PAINT message to be put in the normal message queue.
    zen

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    60

    WM_LBUTTONDBLCLK

    zen, THANKS. Do you think there is anyone on this planet
    who knows those THOUSANDS of functions described in
    the ONLINE-HELP of my IDE?
    Also:
    case WM_LBUTTONDBLCLK:
    is ignored, though I make doubleclicks inside and outside
    the window.
    No matter what I do, it seems DispatchMessage doesn't send
    this message to my WndProc. Why?
    THANKS AGAIN

  4. #4
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Do you think there is anyone on this planet
    who knows those THOUSANDS of functions described in
    the ONLINE-HELP of my IDE?
    I doubt there are many. You just have to get used to used to the terminology, and use the help lots.

    case WM_LBUTTONDBLCLK:
    is ignored
    Does your WNDCLASS have the CS_DBLCLKS style?
    zen

Popular pages Recent additions subscribe to a feed