Thread: Strange SetWindowRgn Problem?

  1. #1
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812

    Question Strange SetWindowRgn Problem?

    Hi,

    Happy New Year to Everyone!

    I'm wondering if someone could help me with a problem? I am using SetWindowRgn to create a transparent window in my C++ app, I am calling the following:


    SetWindowRgn(Handle, CreatePolygonRgn(pnts, cnt, WINDING), Visible);

    where, CreatePolygonReg creates a region based on cnt number of POINTS in array pnt. Handle is the handle to the window and Visible is TRUE or FALSE.


    I am running XP Pro and, on my system, the above works fine.

    HOWEVER, on certain XP systems this call fails IF the Windows Task Manager is visible (i.e. when CTRL+ALT+DEL is pressed). It fails, showing error messages: 'Win32 Error. Code 6. The handle is invalid', or 'A win32 API function failed'.

    Has anyone seen this before?

    Any help appreciated.

    Cheers
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I would check all my return values for success and use GetLastError() if anything fails.
    The error code will (hopefully) give a clue as to why it is failing.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange problem with GETLINE
    By wco5002 in forum C++ Programming
    Replies: 13
    Last Post: 07-07-2008, 09:57 AM
  2. Strange problem
    By G4B3 in forum C Programming
    Replies: 6
    Last Post: 05-14-2008, 02:07 PM
  3. Strange problem with classes in header files
    By samGwilliam in forum C++ Programming
    Replies: 2
    Last Post: 02-29-2008, 04:55 AM
  4. Strange problem
    By ~Kyo~ in forum Game Programming
    Replies: 0
    Last Post: 02-14-2006, 10:35 PM