Thread: Getting Layered Windows to Work

  1. #1
    Si
    Guest

    Unhappy Getting Layered Windows to Work

    Hi,

    I'm trying to get layered windows to work with the Win32api and WinXP. However, no matter how hard I try, I can't get the darn thing to compile! This is the part of the code that does the 'layering':

    LONG_PTR lptr;
    lptr=SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_LAYERED);

    SetLayeredWindowAttributes(hwnd, RGB(0,0,0), 127, LWA_ALPHA);

    And this is the debug report I get:

    --------------------Configuration: wa4 - Win32 Debug--------------------
    Compiling...
    wa4.cpp
    C:\SIMON\TEMP\wa4\wa4.cpp(23) : error C2065: 'WS_EX_LAYERED' : undeclared identifier
    C:\SIMON\TEMP\wa4\wa4.cpp(25) : error C2065: 'SetLayeredWindowAttributes' : undeclared identifier
    C:\SIMON\TEMP\wa4\wa4.cpp(25) : error C2065: 'LWA_ALPHA' : undeclared identifier
    Error executing cl.exe.

    wa4.dll - 3 error(s), 0 warning(s)

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

    It seems that the compiler can't find the necessary identifiers. However, it should be able to, as I've copied all the relevent new windows header and lib files from the August 2001 platform SDK to the Visual C++ 6.00 headers and lib folders.

    Anyone know what's going on?

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Hi

    I've just had a quick glance at winuser.h from the aug2001 psdk.
    At a guess try:

    #define _WIN32_WINNT 0x0500 before you #include windows.h

    I'd be curious to know how you get on with this. Good luck anyway.

  3. #3
    Si
    Guest

    Smile

    It worked! Thank you so much!

    How did you know what to do?

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Superb!

    I'd like to say it's because I have incredible magical powers - well I have said it - but that wouldn't be true.

    1. look up bothersome fns etc in sdk help to find the header they are in.

    2.do a search for said fns in that header. Usually there is at least one of them (i've been lucky so far) that have:

    #ifdef XYZ
    troublesome declare
    #endif

    That gives the required #define. In your example 'WS_EX_LAYERED' came up with the goods.

    But I figured beforehand that it had to be something like that when you mentioned you were using XP.

    I was also very lucky! But thanks for letting me know it worked.

    Happy coding!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. The Bludstayne Open Works License
    By frenchfry164 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-26-2003, 11:05 AM
  2. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  3. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM
  4. Does graphics.h work with windows??
    By sundeeptuteja in forum C++ Programming
    Replies: 6
    Last Post: 09-13-2002, 09:08 AM