FlashWindowEx
-
Why I can't use the FlashWindowEx() with MFC based dialog... it gives me that FlashWindowEx is not declared, any way to use it? thanks in advance...
FlashWindowEx is declared in WinUser.h. If you open WinUser.h and do a text search for FlashWindowEx you will see that FlashWindowEx is wrapped in a pre-processor conditional statement "#if(WINVER >= 0x0500)". So to use FlashWindowEx you have to #define WINVER 0x0500 at the top of your stdafx.h file.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
-
FlashWindowEx is declared in WinUser.h. If you open WinUser.h and do a text search for FlashWindowEx you will see that FlashWindowEx is wrapped in a pre-processor conditional statement "#if(WINVER >= 0x0500)". So to use FlashWindowEx you have to #define WINVER 0x0500 at the top of your stdafx.h file.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
the problem is I don't have FlashWindowEx in the WinUser.h here is what I have
FlashWindow( HWND hWnd, #if(WINVER >= 0x0500) DWORD dwFlags); #else BOOL bInvert); #endif #if(WINVER >= 0x0500) #define FLASHW_STOP 0 #define FLASHW_CAPTION 0x00000001 #define FLASHW_TRAY 0x00000002 #define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY) #define FLASHW_TIMER 0x00000004 #define FLASHW_TIMERNOFG 0x0000000C #endif /* WINVER >= 0x0500 */
any help with it? thanks.... -
the problem is I don't have FlashWindowEx in the WinUser.h here is what I have
FlashWindow( HWND hWnd, #if(WINVER >= 0x0500) DWORD dwFlags); #else BOOL bInvert); #endif #if(WINVER >= 0x0500) #define FLASHW_STOP 0 #define FLASHW_CAPTION 0x00000001 #define FLASHW_TRAY 0x00000002 #define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY) #define FLASHW_TIMER 0x00000004 #define FLASHW_TIMERNOFG 0x0000000C #endif /* WINVER >= 0x0500 */
any help with it? thanks....You've probobly still got a REALLY old version of the platform SDK, you've got two options, either download[^] the latest version or access the FlashWindowEx function on the fly using GetProcAddress[^]. If you choose the later option, you'll need something like:
/* Taken from the MSDN website*/
typedef struct {
UINT cbSize;
HWND hwnd;
DWORD dwFlags;
UINT uCount;
DWORD dwTimeout;
} FLASHEXINFO, *PFLASHEXINFO;#define FLASHW_STOP 0
#define FLASHW_CAPTION 0x00000001
#define FLASHW_TRAY 0x00000002
#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)
#define FLASHW_TIMER 0x00000004
#define FLASHW_TIMERNOFG 0x0000000Ctypedef BOOL (WINAPI *PSFLEX)(PFLASHEXINFO);
static PSFLEX pFlashWindowEx = NULL; // Pointer to actual function
static BOOL initFlash = FALSE; // Loaded statusBOOL uiFlashWindowEx( HWND hWnd, UINT uCount /* Flash Count */, DWORD dwFlags /* check SDK */ )
{
if ( ! initFlash )
{ // Not loaded yet
HMODULE hDLL = NULL;
hDLL = LoadLibrary( TEXT( "user32.dll" ) );
if( hDLL )
{
pFlashWindowEx = ( PSFLEX ) GetProcAddress( hDLL, "FlashWindowEx" );
initFlash = TRUE; // Loaded OK
}
}if ( pFlashWindowEx == NULL ) return FALSE; // Not Supported FLASHEXINFO fwi; ZeroMemory( & fwi, sizeof( FLASHEXINFO ) ); fwi.cbSize = sizeof( FLASHEXINFO ); fwi.dwFlags = dwFlags; fwi.hwnd = hWnd; fwi.uCount = uCount; fwi.dwTimeout = 0L; return pFlashWindowEx ( & fwi );
}
Once done, just use
uiFlashWindowEx( hWnd, 3, FLASHW_TRAY );
or whatever Gavin Taylor w: http://www.gavspace.com -- modified at 12:37 Tuesday 3rd January, 2006 -
You've probobly still got a REALLY old version of the platform SDK, you've got two options, either download[^] the latest version or access the FlashWindowEx function on the fly using GetProcAddress[^]. If you choose the later option, you'll need something like:
/* Taken from the MSDN website*/
typedef struct {
UINT cbSize;
HWND hwnd;
DWORD dwFlags;
UINT uCount;
DWORD dwTimeout;
} FLASHEXINFO, *PFLASHEXINFO;#define FLASHW_STOP 0
#define FLASHW_CAPTION 0x00000001
#define FLASHW_TRAY 0x00000002
#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)
#define FLASHW_TIMER 0x00000004
#define FLASHW_TIMERNOFG 0x0000000Ctypedef BOOL (WINAPI *PSFLEX)(PFLASHEXINFO);
static PSFLEX pFlashWindowEx = NULL; // Pointer to actual function
static BOOL initFlash = FALSE; // Loaded statusBOOL uiFlashWindowEx( HWND hWnd, UINT uCount /* Flash Count */, DWORD dwFlags /* check SDK */ )
{
if ( ! initFlash )
{ // Not loaded yet
HMODULE hDLL = NULL;
hDLL = LoadLibrary( TEXT( "user32.dll" ) );
if( hDLL )
{
pFlashWindowEx = ( PSFLEX ) GetProcAddress( hDLL, "FlashWindowEx" );
initFlash = TRUE; // Loaded OK
}
}if ( pFlashWindowEx == NULL ) return FALSE; // Not Supported FLASHEXINFO fwi; ZeroMemory( & fwi, sizeof( FLASHEXINFO ) ); fwi.cbSize = sizeof( FLASHEXINFO ); fwi.dwFlags = dwFlags; fwi.hwnd = hWnd; fwi.uCount = uCount; fwi.dwTimeout = 0L; return pFlashWindowEx ( & fwi );
}
Once done, just use
uiFlashWindowEx( hWnd, 3, FLASHW_TRAY );
or whatever Gavin Taylor w: http://www.gavspace.com -- modified at 12:37 Tuesday 3rd January, 2006