Messages sent to WinProc()

This is a discussion on Messages sent to WinProc() within the Windows Programming forums, part of the Platform Specific Boards category; By trying to test which case in the switch within WinProc get executed often, I've forced repainting by using timer ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    610

    Messages sent to WinProc()

    By trying to test which case in the switch within WinProc get executed often, I've forced repainting by using timer & InvalidateRec. To test i've put a three break-points 1 next to..
    Code:
     default:
    		return DefWindowProc(hwnd,uMsg,wParam,lParam);
    the other two, where InvalidateRect is called (within WM_TIMER), and third inside WM_PAINT. Press F5 for debug and kept my finger on F5 & noticed that it hardly ever go to WM_TIMER or WM_PAINT but comes to default more often than not... Is that normal?, i thought defaults in switch statements suppose to happen only if things are abnormal...what message values are set to variable message?
    Code:
    case(message)
    I noticed mine are random integers which is the reason it always ends on default.

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,172
    Pressing F5 once will start your program in Debug mode. Keeping it pressed down is not a good idea.
    Pressing F5 when hitting a breakpoint will make it resume execution.
    The default case gets executed if no other case matches.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by Elysia View Post
    Keeping it pressed down is not a good idea.
    didn't literally mean that, i pressed a number of times. By putting breakpoints both on WM_PAINT and default i would expect WM_PAINT to execute more... But since am using timer to repaint, maybe in debug mode timer doesn't execute anyway, and ends up not getting InvalidateRect messages... so i guess the answer is it's normal!

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,172
    Debug mode has nothing to do with the timer...
    It will break if you put a breakpoint under WM_PAINT and your window gets a WM_PAINT message.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Messages Between Different Architectures
    By Cell in forum Linux Programming
    Replies: 5
    Last Post: 05-07-2009, 03:40 AM
  2. Spy++ view messages posted/sent to a control, or from it?
    By hanhao in forum Windows Programming
    Replies: 2
    Last Post: 06-24-2007, 11:07 PM
  3. Sending windows messages
    By Ideswa in forum Windows Programming
    Replies: 2
    Last Post: 03-02-2006, 12:27 PM
  4. WinProc in separate file
    By ChrisWard1000 in forum Windows Programming
    Replies: 2
    Last Post: 09-10-2004, 07:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21