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. Windows API
  4. GetWindowRgn API is failed.

GetWindowRgn API is failed.

Scheduled Pinned Locked Moved Windows API
helpjsonquestion
2 Posts 2 Posters 5 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
    atm menon
    wrote on last edited by
    #1

    In My application, I have used the following code to get the region of a dialog.

    HRGN hRgn = CreateRectRgn( 0, 0, 0, 0 );
    int nRet = GetWindowRgn( hRgn );
    if(ERROR == nRet)
    {
    DWORD dw= GetLastError();
    //Log
    }

    The problem is that, sometimes "GetWindowRgn" returns error "invalid handle" even if CreateRectRgn returns a non-null handle which is used for GetWindowRgn. I have set the region in onSize(). So dialog have region.Also after GetWindowRgn returns error, when i call GetWindowRgn() again, second call is working fine !!! Issue is reproduced only sometimes in a Windows 7 machine. Anyone already faced similar issue? Thanks, Arun

    L 1 Reply Last reply
    0
    • A atm menon

      In My application, I have used the following code to get the region of a dialog.

      HRGN hRgn = CreateRectRgn( 0, 0, 0, 0 );
      int nRet = GetWindowRgn( hRgn );
      if(ERROR == nRet)
      {
      DWORD dw= GetLastError();
      //Log
      }

      The problem is that, sometimes "GetWindowRgn" returns error "invalid handle" even if CreateRectRgn returns a non-null handle which is used for GetWindowRgn. I have set the region in onSize(). So dialog have region.Also after GetWindowRgn returns error, when i call GetWindowRgn() again, second call is working fine !!! Issue is reproduced only sometimes in a Windows 7 machine. Anyone already faced similar issue? Thanks, Arun

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You already posted this in the C++ forum; please do not crosspost, it wastes everyone's time.

      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