Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC and SDK???

MFC and SDK???

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leesen
    wrote on last edited by
    #1

    Hi,all Is the OnPaint function in MFC just the same as the content between BeginPaint and EndPaint in SDK???? Does the system create WM_PAINT after it receive WM_SETCURSOR? Now there are some problems in my application.I describe it simply just as below. Firstly: OnPaint() { LoadBigBitmap(); //can fill the whole client view if(m_flag) LoadSmallBitmap(); } OnLButtonDown() { m_flag=TRUE; Invalidate(FALSE); UpdateWindow(); } OnSetCursor() { // set my own Cursor and return TRUE } Then, when I run this application, errors occurrs. First, it display the BigBitmap . After I click down on the client view, then it would display the SmallBitmap,although,just for a while. then when I move the cursor the SmallBitmap will disappear. It disturbs me for long time, who can help me??? All your help will be appreciated! Regards.

    M 1 Reply Last reply
    0
    • L Leesen

      Hi,all Is the OnPaint function in MFC just the same as the content between BeginPaint and EndPaint in SDK???? Does the system create WM_PAINT after it receive WM_SETCURSOR? Now there are some problems in my application.I describe it simply just as below. Firstly: OnPaint() { LoadBigBitmap(); //can fill the whole client view if(m_flag) LoadSmallBitmap(); } OnLButtonDown() { m_flag=TRUE; Invalidate(FALSE); UpdateWindow(); } OnSetCursor() { // set my own Cursor and return TRUE } Then, when I run this application, errors occurrs. First, it display the BigBitmap . After I click down on the client view, then it would display the SmallBitmap,although,just for a while. then when I move the cursor the SmallBitmap will disappear. It disturbs me for long time, who can help me??? All your help will be appreciated! Regards.

      M Offline
      M Offline
      mloibl
      wrote on last edited by
      #2

      some extracts from the mfc-sources: CPaintDC::CPaintDC(CWnd* pWnd) { ... ::BeginPaint(m_hWnd = pWnd->m_hWnd, &m_ps); ... } CPaintDC::~CPaintDC() { ... ::EndPaint(m_hWnd, &m_ps); ... } void CView::OnPaint() { // standard paint routine CPaintDC dc(this); OnPrepareDC(&dc); OnDraw(&dc); } So you are right: BeginPaint begins within the constructor CPaintDC dc(this), EndPaint is called from within the destructor; it's called when the local CPaintDC goes out of scope and that's at the end of CView::OnPaint. If you look more precise at the sources, you'll find out that some extra work is done by MFC (OnPrepareDC, ...) Markus

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups