Windows Application OnPaint() Function

This is a discussion on Windows Application OnPaint() Function within the Windows Programming forums, part of the Platform Specific Boards category; Good day, My IDE : vs 2005 My windows forms application inclued one main window and two sub windows. There ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    48

    Windows Application OnPaint() Function

    Good day,

    My IDE : vs 2005

    My windows forms application inclued one main window and two sub windows. There is a beautiful skin color at the main window; but there is no skin color for the other two windows)

    When i right click my "void CMainDlg::OnPaint()" and check "Find All References".
    3 match found:
    afxms_.h (static_cast< void (AFX_MSG_CALL CWnd::*)(void) > ( &ThisClass :: OnPaint)) },
    mainDlg.cpp: void CSECS_AMECDlg::OnPaint();
    mainDlg.h: afx_msg void OnPaint(); (protected declared)

    My question,
    1. does OnPain() Function was called by system thread automaically when my windows forms app load.

    2. When i add the OnPain() function for the two sub windows, the OnPain() function won't be called automatically.

    Could you tell me more about OnPaint() ......


    thanks!
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    48
    More Debug Information.

    If i keep on Step Out(Shift + F11), the Yellow Arrow will Just to "wincore.cpp".....then the Yellow Arrow Will Jumed into a "Disassembly" window....

    And if i keep on Step Over (F10), same !!!

    ?
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    48
    trace by myself :-)

    Currently i understand the OnPoint() function for my project.

    The problem is not the window Forms application issue, it is a MFC application. Windows send message to my application.l When message WM_PAINT arrives then MFC Library calls my OnPaint function. a line like
    On_WM_PAINT()

    Now i already understand this scenario.

    Thanks!
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Quote Originally Posted by userpingz View Post
    Windows send message to my application.l When message WM_PAINT arrives then MFC Library calls my OnPaint function. a line like
    On_WM_PAINT()
    That sounds correct.

    You can also send your own WM_PAINT message with;

    InvalidateRect() //send a paint message
    UpdateWindow() //bypass the windows message queue and post the paint message directly to the window (much faster)
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 10:59 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 09:56 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM

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