Thread: FlashWindowEx not declared?

  1. #1
    Registered User
    Join Date
    Dec 2002

    Unhappy FlashWindowEx not declared?

    Hi, all

    I am writing a program in Visual C++ 6.0 Service Pack 5 that uses the FlashWindowEx() function. But when I compile the program it says:

    error C2065: 'FlashWindowEx' : undeclared identifier

    I have included both the windows.h and winuser.h but neither declares this function, but according to MSDN the requirements are:

    Windows NT/2000/XP: Included in Windows 2000 and later.
    Windows 95/98/Me: Included in Windows 98 and later.
    Header: Declared in Winuser.h; include Windows.h.
    Library: Use User32.lib.

    I have even tried to declare it my self by writing:

    #pragma comment(lib,"user32.lib")
    __declspec(dllimport) BOOL FlashWindowEx (FLASHWINFO *pfwi);
    But it didn’t work. I know I can use LoadLibrary and call the function from there, but it seems to strange that it isn’t declared in neither windows.h or winuser.h. Where can I find a windows.h and/or winuser.h that declares it, and I suppose that I would also need user32.lib.
    Last edited by Aidman; 05-16-2003 at 10:43 AM.

  2. #2
    Join Date
    Jan 2002
    It's declared in winuser.h from oct 2002 psdk as:
    #if(WINVER >= 0x0500)
    typedef struct {
        UINT  cbSize;
        HWND  hwnd;
        DWORD dwFlags;
        UINT  uCount;
        DWORD dwTimeout;
        PFLASHWINFO pfwi);
    #define FLASHW_STOP         0
    #define FLASHW_CAPTION      0x00000001
    #define FLASHW_TRAY         0x00000002
    #define FLASHW_TIMER        0x00000004
    #define FLASHW_TIMERNOFG    0x0000000C
    #endif /* WINVER >= 0x0500 */
    But is absent from msvc6 winuser.h. I don't know if it's declared in winuser.h from the aug 2001 psdk.

    In any event, you could use the above declares, ensuring you #define WINVER 0x0500 and link with user32.lib normally (the fn does appear in user32.lib with the default msvc6 psdk distribution).

    You should probably get and install the oct 2002 psdk from microsoft anyway.

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    got help files?

    Using the SDK Headers
    This version of the Microsoft® Platform SDK targets applications for Microsoft Windows® 95, Microsoft Windows NT® 4.0, Microsoft Windows® 98, Microsoft Windows Millennium Edition (Windows Me), Microsoft Windows 2000, Microsoft Windows XP, and Microsoft Windows .NET Server using the header file conventions below.

    The makefiles generated by Microsoft Visual C++® 5.0 and 6.0 target Windows NT 3.51 by default. To use functions introduced in Windows NT 4.0 or later, which are protected by conditional code, you must define the appropriate macros. Otherwise, you will receive the following error message from the compiler: error C2065: undeclared identifier. You may also need to ensure that the INCLUDE environment variable has the path to the Platform SDK header files listed before the path to the Visual C++ header files. Otherwise, you will receive error C2065 for items that were introduced after Visual C++ was released.

    The following table indicates the macros you must define to target each system using the SDK headers.

    Minimum System Required Macros to Define
    Windows 95 and
    Windows NT 4.0 WINVER=0x0400
    Windows 98 and
    Windows NT 4.0 _WIN32_WINDOWS=0x0410 and WINVER=0x0400
    Windows NT 4.0 _WIN32_WINNT=0x0400 and WINVER=0x0400
    Windows 98 _WIN32_WINDOWS=0x0410
    Windows 2000 _WIN32_WINNT=0x0500 and WINVER=0x0500
    Windows Me _WIN32_WINDOWS=0x0490
    Windows XP and
    Windows .NET Server _WIN32_WINNT=0x0501 and WINVER=0x0501
    Internet Explorer 3.0, 3.01, 3.02 _WIN32_IE=0x0300
    Internet Explorer 4.0 _WIN32_IE=0x0400
    Internet Explorer 4.01 _WIN32_IE=0x0401
    Internet Explorer 5.0, 5.0a, 5.0b _WIN32_IE=0x0500
    Internet Explorer 5.01, 5.5 _WIN32_IE=0x0501
    Internet Explorer 6.0 _WIN32_IE=0x0560 or

    If you are writing your own makefile, the macros in Win32.mak can help you use the correct conventions. The value of _WIN32_WINNT is set in Win32.mak, depending on the platform you choose to target. For more information, see Building Applications Using Win32.mak.

    The Platform SDK headers use guard statements to determine the system on which each function is supported. The following table describes these statements.

    Guard Statement Meaning
    #if _WIN32_WINNT >= 0x0400 Windows NT 4.0 and later. It is not implemented in Windows 95.
    #if _WIN32_WINDOWS >= 0x0410 Windows 98. The image may not run on Windows 95.
    #if _WIN32_WINDOWS >= 0x0490 Windows Me. The image may not run on Windows 95/98, Windows NT, or Windows 2000.
    #if _WIN32_WINNT >= 0x0500 Windows 2000. The image may not run on Windows 95/98 or Windows NT.
    #if _WIN32_WINNT >= 0x0501 Windows XP. The image may not run on Windows 95/98, Windows NT, Windows Me, or Windows 2000.
    #if _WIN32_IE >= 0x0300 Internet Explorer 3.0 and later.
    #if _WIN32_IE >= 0x0400 Internet Explorer 4.0 and later.
    #if _WIN32_IE >= 0x0401 Internet Explorer 4.01 and later.
    #if _WIN32_IE >= 0x0500 Internet Explorer 5.0 and later.
    #if _WIN32_IE >= 0x0501 Internet Explorer 5.01 and later.
    #if _WIN32_IE >= 0x0560 Internet Explorer 6.0 and later
    #if _WIN32_IE >= 0x0600 Internet Explorer 6.0 and later

    For example, if you do not include Win32.mak in your makefile, you need to explicitly define _WIN32_WINNT as 0x0500 to use the Windows 2000-specific material in the header files.

    There are functions in Windows 95 OEM Service Release 2 that are guarded by (_WIN32_WINNT >= 0x0400), such as the Cryptographic Application Programming Interface (CryptoAPI). If you are writing an application specifically for Windows 95 OEM Service Release 2, and you want the header files to provide compile time access to these functions, it is necessary to define _WIN32_WINNT as 0x0400. Note that an application using these functions does not run correctly on the retail release of Windows 95. In general, applications expected to run on Windows 95 should be built without defining _WIN32_WINNT.

    This version of the Platform SDK can also be used to build applications for 64-bit Windows. The header files use new data types that allow you to build both 32- and 64-bit versions of your application from a single source code base. For more information, see Getting Ready for 64-bit Windows.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

  4. #4
    Registered User
    Join Date
    Dec 2002
    Ok Thanks!
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. variables when declared inside or outside a function
    By jas_atwal in forum C Programming
    Replies: 6
    Last Post: 12-14-2007, 02:42 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. Nested loop frustration
    By caroundw5h in forum C Programming
    Replies: 14
    Last Post: 03-15-2004, 09:45 PM