Menu

Help with SetLayeredWindowAttributes

2003-02-12
2012-09-26
  • Nobody/Anonymous

    anybody know how to use the SetLayeredWindowAttributes function??

    I use this code:

    #define LWA_COLORKEY 0x00000001
    #define LWA_ALPHA 0x00000002

    --------------------------------------------------------------

    typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
    lpfnSetLayeredWindowAttributes SetLayeredWindowAttributes;

    HMODULE hUser32 = GetModuleHandle("user32.dll");
    SetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)GetProcAddress(hUser32,"SetLayeredWindowAttributes");

    -----------------------------------------------------------------------------
    and

    SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
    SetLayeredWindowAttributes(hwnd, 0, (255 * 70) / 100, LWA_ALPHA);

    These are the errors:

    ISO C++ forbids declaration of `
       SetLayeredWindowAttributes' with no type

    conflicting types for `int SetLayeredWindowAttributes'

    previous declaration as `BOOL
       (*SetLayeredWindowAttributes)(HWND__*, long unsigned int, unsigned char,
       long unsigned int)'

    invalid conversion from `BOOL (*)(HWND__*, long unsigned
       int, unsigned char, long unsigned int)' to `int'

    In function `void RegionMe(HWND__*)':
    `SetLayeredWindowAttributes' cannot be used as a function

    I am aware that this only works on win2000 and XP (I have win2000) so that should not be the problem.

    Anybody ?? Many thanks in advance

    /Blackbird

     
    • Nobody/Anonymous

      Im also stuck with SetLayeredWindowsAttributes... I am so insane with it that I am trying to get user32.lib to user32.a to see if it solves my problems :(

       
    • Nobody/Anonymous

      The code above should load user32.dll dynamically and there was no error about unresolved external symbols . . .

      /Blackbird

       
    • Nobody/Anonymous

      yes, please, I'm stuck at teh same prob . . .

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.