1. #1
    Registered User actionbasti's Avatar
    Join Date
    Dec 2002

    Question WM_PAINT and WM_CREATE

    Hello .
    I am still very new to Win32 API, and the tutorials that I have dont tell me what the Difference between

    WM_PAINT and WM_CREATE is!

    Can someone tell me that, like what goes to the one and what goes into the other as examples?

    Thanks in advance !

  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    WM_CREATE is called once when the window or dialog is created. It is in response to a CreateWindow() or CreateDialog() call. This means it must be called by the app.

    WM_PAINT is called everytime the app needs to update the screen. It can be called by windows or by the app.
    It should contain as little code as possible (BeginPaint() and EndPaint() are required)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Nov 2001
    Also WM_CREATE happens when the app starts and only when it starts. WM_PAINT happens when it has to redraw the screen. For example restoring it from the minimazatrion or drapping a window over it.
    "Christ died for our sins. Dare we make his martyrdom meaningless by not committing them?"

  4. #4

  5. #5
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    So basically:

    WM_CREATE is there so you can perform one time operations like you might create an edit control here and give it initial text.

    WM_PAINT is sent to your window whenever you need to update part of the client area, such as when it has just been minimised or uncovered from another window.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  6. #6
    Registered User actionbasti's Avatar
    Join Date
    Dec 2002
    Thanks everybody that helped a lot!

Popular pages Recent additions subscribe to a feed