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. SetWindowRgn problems

SetWindowRgn problems

Scheduled Pinned Locked Moved C / C++ / MFC
help
6 Posts 4 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
    Ceri
    wrote on last edited by
    #1

    Hi, I have a audio player that is skinned. There are 4 seperate regions (different states in the player). I create these regions before hand on program start up. My problem is that when I try to set a region that has already been used before the SetWindowRgn function fails (I'm guessing because windows deleted it or something) I want to avoid creating the region on the fly because it takes a second or so to create the region from the bitmaps that I use for skinning. Is there anyway to stop windows from deleteting the region after you set the window region to a different one. Thanks

    J J 2 Replies Last reply
    0
    • C Ceri

      Hi, I have a audio player that is skinned. There are 4 seperate regions (different states in the player). I create these regions before hand on program start up. My problem is that when I try to set a region that has already been used before the SetWindowRgn function fails (I'm guessing because windows deleted it or something) I want to avoid creating the region on the fly because it takes a second or so to create the region from the bitmaps that I use for skinning. Is there anyway to stop windows from deleteting the region after you set the window region to a different one. Thanks

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      Ceri wrote: Is there anyway to stop windows from deleteting the region after you set the window region to a different one No. MSDN states: After a successful call to SetWindowRgn, the operating system owns the region specified by the region handle hRgn. The operating system does not make a copy of the region, so do not make any further function calls with this region handle, and do not close this region handle But you can use CRgn::CopyRgn() to make a local copy of your region, before you feed it to the API.


      My opinions may have changed, but not the fact that I am right.

      C 1 Reply Last reply
      0
      • C Ceri

        Hi, I have a audio player that is skinned. There are 4 seperate regions (different states in the player). I create these regions before hand on program start up. My problem is that when I try to set a region that has already been used before the SetWindowRgn function fails (I'm guessing because windows deleted it or something) I want to avoid creating the region on the fly because it takes a second or so to create the region from the bitmaps that I use for skinning. Is there anyway to stop windows from deleteting the region after you set the window region to a different one. Thanks

        J Offline
        J Offline
        Joaquin M Lopez Munoz
        wrote on last edited by
        #3

        Ummm. Maybe you can copy the region (CopyRgn) before passing it on to the windows with SetWindowRgn so that you have always a fresh copy to work with. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        1 Reply Last reply
        0
        • J jhwurmbach

          Ceri wrote: Is there anyway to stop windows from deleteting the region after you set the window region to a different one No. MSDN states: After a successful call to SetWindowRgn, the operating system owns the region specified by the region handle hRgn. The operating system does not make a copy of the region, so do not make any further function calls with this region handle, and do not close this region handle But you can use CRgn::CopyRgn() to make a local copy of your region, before you feed it to the API.


          My opinions may have changed, but not the fact that I am right.

          C Offline
          C Offline
          Ceri
          wrote on last edited by
          #4

          Is the CopyRgn function of the CRgn class fast enough so that it does not show a delay.

          J H 2 Replies Last reply
          0
          • C Ceri

            Is the CopyRgn function of the CRgn class fast enough so that it does not show a delay.

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #5

            Sorry, I have no idea. Just remember to tell here if you find out ;) Good luck with you project!


            My opinions may have changed, but not the fact that I am right.

            1 Reply Last reply
            0
            • C Ceri

              Is the CopyRgn function of the CRgn class fast enough so that it does not show a delay.

              H Offline
              H Offline
              Hans Ruck
              wrote on last edited by
              #6

              It should be. Anyway, i think this API must be the fastest:

              DWORD dw;
              RGNDATA *lp;
              HRGN hRgnCopy;

              dw=::GetRegionData(hRgn, sizeof(RGNDATA), NULL);
              lp=(RGNDATA *)(new char[dw]);
              hRgnCopy=::ExtCreateRegion(NULL, dw, lp);
              delete lp;

              rechi

              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