Thread: Messages sent to WinProc()

  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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.

  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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.

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, 01:27 PM
  4. WinProc in separate file
    By ChrisWard1000 in forum Windows Programming
    Replies: 2
    Last Post: 09-10-2004, 07:27 AM