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. Problem in getting WM_KILLFOCUS

Problem in getting WM_KILLFOCUS

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 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.
  • A Offline
    A Offline
    ashtwin
    wrote on last edited by
    #1

    Hi, i am working on a control derived from COleControl class. I want to delete a DC whenever the control get out of focus. But in case when i am pressing window key from the keyboard, OnKillFocus() function is not working properly. Can anybody suggest an alternate solution. Thanks.

    R 1 Reply Last reply
    0
    • A ashtwin

      Hi, i am working on a control derived from COleControl class. I want to delete a DC whenever the control get out of focus. But in case when i am pressing window key from the keyboard, OnKillFocus() function is not working properly. Can anybody suggest an alternate solution. Thanks.

      R Offline
      R Offline
      Rajkumar R
      wrote on last edited by
      #2

      IMHO use paint DC which spans only within the paint handler.

      A 1 Reply Last reply
      0
      • R Rajkumar R

        IMHO use paint DC which spans only within the paint handler.

        A Offline
        A Offline
        ashtwin
        wrote on last edited by
        #3

        Hi, actually i am using the DC to call DrawDragRect function. On LButtonDown i am capturing the mouse and creating the DC and on LButtonUp i am releasing the capture and deleting the dc. But if user is pressing the the window button, OnLButtonUp is not getting called and the DC is not getting deleted. Thanks

        R 1 Reply Last reply
        0
        • A ashtwin

          Hi, actually i am using the DC to call DrawDragRect function. On LButtonDown i am capturing the mouse and creating the DC and on LButtonUp i am releasing the capture and deleting the dc. But if user is pressing the the window button, OnLButtonUp is not getting called and the DC is not getting deleted. Thanks

          R Offline
          R Offline
          Rajkumar R
          wrote on last edited by
          #4

          I think that is because your application lost capture when windows key is pressed. May be you need to handle the WM_CAPTURECHANGED Notification also.

          A 1 Reply Last reply
          0
          • R Rajkumar R

            I think that is because your application lost capture when windows key is pressed. May be you need to handle the WM_CAPTURECHANGED Notification also.

            A Offline
            A Offline
            ashtwin
            wrote on last edited by
            #5

            Hi, the application is working fine after using OnCaptureChanged. Thanks

            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