FLASHWINFO

FLASHWINFO結構,包含系統應在指定時間內閃爍視窗次數和閃爍狀態的信息。Windows API之FlashWindowEx(用於閃爍指定的視窗,它不會更改視窗的激活狀態)的傳入參數。

基本介紹

  • 中文名:FLASHWINFO
  • 外文名:FLASHWINFO
  • 相關API:FlashWindowEx
結構原型,結構成員,系統要求,C#,

結構原型

typedef struct {
UINT cbSize;
HWND hwnd;
DWORD dwFlags;
UINT uCount;
DWORD dwTimeout;
} FLASHWINFO, *PFLASHWINFO;

結構成員

  • cbSize
  • The size of the structure, in bytes.
  • hwnd
  • A handle to the window to be flashed. The window can be either opened or minimized.
  • dwFlags
  • The flash status. This parameter can be one or more of the following values.
ValueMeaning
FLASHW_ALL
0x00000003
Flash both the window caption and taskbar button. This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
FLASHW_CAPTION
0x00000001
Flash the window caption.
FLASHW_STOP
0
Stop flashing. The system restores the window to its original state.
FLASHW_TIMER
0x00000004
Flash continuously, until the FLASHW_STOP flag is set.
FLASHW_TIMERNOFG
0x0000000C
Flash continuously until the window comes to the foreground.
FLASHW_TRAY
0x00000002
Flash the taskbar button.
  • uCount
  • The number of times to flash the window.
  • dwTimeout
  • The rate at which the window is to be flashed, in milliseconds. IfdwTimeoutis zero, the function uses the default cursor blink rate.

系統要求

Minimum supported client
WindowsXP [desktop apps only]
Minimum supported server
Windows Server2003 [desktop apps only]
Header
Winuser.h (include Windows.h)

C#

定義及套用
API導入
/// <summary>
/// 閃爍視窗
/// </summary>
/// <param name="pwfi">視窗閃爍信息結構</param>
/// <returns></returns>
[DllImport("user32.dll")]
public static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
閃爍類型枚舉定義
/// <summary>
/// 閃爍類型
/// </summary>
public enum flashType : uint
{
FLASHW_STOP = 0, //停止閃爍
FALSHW_CAPTION = 1, //只閃爍標題
FLASHW_TRAY = 2, //只閃爍系統列
FLASHW_ALL = 3, //標題和系統列同時閃爍
FLASHW_PARAM1 = 4,
FLASHW_PARAM2 = 12,
FLASHW_TIMER = FLASHW_TRAY | FLASHW_PARAM1, //無條件閃爍系統列直到傳送停止標誌或者視窗被激活,如果未激活,停止時高亮
FLASHW_TIMERNOFG = FLASHW_TRAY | FLASHW_PARAM2 //未激活時閃爍系統列直到傳送停止標誌或者窗體被激活,停止後高亮
}
FLASHWINFO結構定義
/// <summary>
/// 包含系統應在指定時間內閃爍視窗次數和閃爍狀態的信息
/// </summary>
public struct FLASHWINFO
{
/// <summary>
/// 結構大小
/// </summary>
public uint cbSize;
/// <summary>
/// 要閃爍或停止的視窗句柄
/// </summary>
public IntPtr hwnd;
/// <summary>
/// 閃爍的類型
/// </summary>
public uint dwFlags;
/// <summary>
/// 閃爍視窗的次數
/// </summary>
public uint uCount;
/// <summary>
/// 視窗閃爍的頻度,毫秒為單位;若該值為0,則為默認圖示的閃爍頻度
/// </summary>
public uint dwTimeout;
}
閃爍視窗方法封裝
/// <summary>
/// 閃爍視窗
/// </summary>
/// <param name="hWnd">視窗句柄</param>
/// <param name="type">閃爍類型</param>
/// <returns></returns>
public static bool FlashWindowEx(IntPtr hWnd, flashType type)
{
FLASHWINFO fInfo = new FLASHWINFO();
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
fInfo.hwnd = hWnd;//要閃爍的視窗的句柄,該視窗可以是打開的或最小化的
fInfo.dwFlags = (uint)type;//閃爍的類型
fInfo.uCount = UInt32.MaxValue;//閃爍視窗的次數
fInfo.dwTimeout = 0; //視窗閃爍的頻度,毫秒為單位;若該值為0,則為默認圖示的閃爍頻度
return FlashWindowEx(ref fInfo);
}

相關詞條

熱門詞條

聯絡我們