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. ReleaseDC is not working

ReleaseDC is not working

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 3 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.
  • M Offline
    M Offline
    MaTrIX2k2
    wrote on last edited by
    #1

    why ReleaseDC is not saving my information.

    P P 2 Replies Last reply
    0
    • M MaTrIX2k2

      why ReleaseDC is not saving my information.

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #2

      [edited - my brain works faster than my fingers] ReleaseDC() does not save information. Please provide more info. --- CPUA 0x5041 Sonork 100.11743 Chicken Little If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?

      M 1 Reply Last reply
      0
      • M MaTrIX2k2

        why ReleaseDC is not saving my information.

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

        If you want the data for a DC from a window to be persistent after you call ReleaseDC, then you need to create your window with the CS_OWNDC or CS_CLASSDC style.


        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!

        M 1 Reply Last reply
        0
        • P PJ Arends

          [edited - my brain works faster than my fingers] ReleaseDC() does not save information. Please provide more info. --- CPUA 0x5041 Sonork 100.11743 Chicken Little If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?

          M Offline
          M Offline
          MaTrIX2k2
          wrote on last edited by
          #4

          I'm making a window that acts as a menu, see: this is my command: ShowMenu(BOOL bFromKey, int x, int y,CWnd* pParent, HMENU hMenu) and i have a CMenu named m_pMenu i convert the hMenu into a CMenu: m_pMenu->m_hMenu = hMenu; this is ok, now i create my window using the CreateEx command, after my window is created i call another class called DrawMenuItem, this one get the size of all the menuitems stored in the m_pMenu, after get the size of the items, i assing the size to the window using the MoveWindow, after this the window is showed using the ShowWindow, then i call the ReleaseDC to make m_pMenu free for use for every class, but here's the problem when the menu is showed it call the OnPaint, in this i paint the background and i draw the menu text for the menuitems, but the m_pMenu is empty in this, why if it's supposed to be the m_pMenu of the ShowMenu command?

          P 1 Reply Last reply
          0
          • P Paul M Watt

            If you want the data for a DC from a window to be persistent after you call ReleaseDC, then you need to create your window with the CS_OWNDC or CS_CLASSDC style.


            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!

            M Offline
            M Offline
            MaTrIX2k2
            wrote on last edited by
            #5

            is not working either :confused:

            P 1 Reply Last reply
            0
            • M MaTrIX2k2

              I'm making a window that acts as a menu, see: this is my command: ShowMenu(BOOL bFromKey, int x, int y,CWnd* pParent, HMENU hMenu) and i have a CMenu named m_pMenu i convert the hMenu into a CMenu: m_pMenu->m_hMenu = hMenu; this is ok, now i create my window using the CreateEx command, after my window is created i call another class called DrawMenuItem, this one get the size of all the menuitems stored in the m_pMenu, after get the size of the items, i assing the size to the window using the MoveWindow, after this the window is showed using the ShowWindow, then i call the ReleaseDC to make m_pMenu free for use for every class, but here's the problem when the menu is showed it call the OnPaint, in this i paint the background and i draw the menu text for the menuitems, but the m_pMenu is empty in this, why if it's supposed to be the m_pMenu of the ShowMenu command?

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

              So let me get this clear, you are painting the background and text in the menu, but ... A) you never see the text appear on the menu B) you see the text appear on the menu, but the next time it appears the text is gone First, I would say that if you are painting the background in the OnPaint handler, then you need to handle the OnEraseBkgnd handler as well and simply return TRUE in your implmentation of this function. second if your answer to the above statement is choice A, I would say make sure that you are drawing in the proper coordinates for you window. It is possible that you have miscalculated the region that you should be drawing and you are not drawing on a region where the menu window exists. If your answer is B, then I will have to ask some more questions. Good Luck!


              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
              • M MaTrIX2k2

                is not working either :confused:

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

                Based on your reply to PJ Arends response, the styles of your window are not the problem. I responded to the other thread, I hope that helps you.


                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