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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Passing WM_PAINT to dll from EXE

Passing WM_PAINT to dll from EXE

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • C Offline
    C Offline
    Chris Klecker
    wrote on last edited by
    #1

    I'm trying to have my EXE pass an WM_PAINT message to a dll with no luck. The last idea I had was to use the following m_SpellCastingBar.SendMessage(WM_PAINT); however this did not work as well. I have tried Invalidating the rectangle however I'm not sure if I'm even reaching the dll with this call as the WM_PAINT message is not getting retrieved by the dll. Might there be something I am missing? Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

    P 1 Reply Last reply
    0
    • C Chris Klecker

      I'm trying to have my EXE pass an WM_PAINT message to a dll with no luck. The last idea I had was to use the following m_SpellCastingBar.SendMessage(WM_PAINT); however this did not work as well. I have tried Invalidating the rectangle however I'm not sure if I'm even reaching the dll with this call as the WM_PAINT message is not getting retrieved by the dll. Might there be something I am missing? Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      You should not pass WM_PAINT messages to windows. Windows will ignore them anyway. Windows only generates paint messages itself if the message queue for that thread is empty. Even then the target window needs to have an invalid area on it window rect for a paint message to be generated. When you were looking to invalidate the rect of the window that is more along the lines of what you need to do. If you want to force a repaint of the window use the RedrawWindow function. Here is an example.

      m_SpellCastingBar.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_UPDATENOW);

      The first two nulls indicate that you want the entire window to be updated. The flags say that you are invalidating the update region of your window because you can validate the window as well and prevent WM_PAINT messages from being called. RDW_NOERASE says do not generate a WM_ERASEBKGND message, and the RDW_UPDATENOW flag says expedite this request, and send the WM_PAINT message before the function call ends. Coincidentally, these two function calls will do the equivalent of the RedrawWindow function above.

      m_SpellCastingBar.InvalidateRect(NULL);
      m_SpellCastingBar.UpdateWindow();


      Build a man a fire, and he will be warm for a day
      Light a man on fire, and he will be warm for the rest of his life!

      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