Windows API
In addition to coordinating application execution, allocating memory, managing resources, Windows is a multi-job system ... , it is also a large service center, invoking the service center of the various services (each service is a function), can help the application to open windows, graphics, use peripheral devices, and so on, because these functions serve the object is the application (application), so called Application programming Interface, referred to as API functions. The WIN32 API is the application programming interface for Microsoft Windows 32-bit platforms.
FlashWindowEx
function function : blinks the specified window. It does not change the activation state of the window.
function prototype : BOOL WINAPI FlashWindowEx (
__in Pflashwinfo Pfwi
);
parameters : pfwi pointer to flashwinfo structure.
return value : Returns the specified window state before calling the FlashWindowEx function. If the window caption is active before the call, the return value is a value other than 0.
Ways to implement window Flicker API import
// <summary> /// Flashing window // </summary> /// <param name= "pwfi" > window Flicker information structure </param> /// <returns></returns> [DllImport ("User32.dll")] Public Static extern BOOL FlashWindowEx(refFlashwinfo PWFI);
Flicker Type Enumeration Definition
// <summary> /// Flashing type // </summary> Public enumFlashtype:UINT{flashw_stop =0,//Stop flashingFalshw_caption =1,//Flashing title onlyFlashw_tray =2,//flash taskbar onlyFlashw_all =3,//title and taskbar flashing simultaneouslyFLASHW_PARAM1 =4, flashw_param2 = A, Flashw_timer = Flashw_tray | FLASHW_PARAM1,//unconditionally blink taskbar until send Stop flag or window is activated, if inactive, highlight when stoppedFlashw_timernofg = Flashw_tray | Flashw_param2flashing the taskbar until the stop flag is sent or the form is activated when it is not activated, highlighting after stopping}
Flashwinfo structure Definition
// <summary> ///contains information that the system should blink the number of Windows and blink status within a specified time // </summary> Public structFlashwinfo {// <summary> // structure size // </summary> Public UINTcbsize;// <summary> ///window handle to blink or stop // </summary> PublicINTPTR hwnd;// <summary> /// Flashing type // </summary> Public UINTDwFlags;// <summary> /// flashes the number of Windows // </summary> Public UINTUcount;// <summary> ///The frequency of the blink of the window, in milliseconds; if the value is 0, the blink frequency of the default icon // </summary> Public UINTdwTimeOut; }
Flashing Window Method Encapsulation
// <summary> /// Flashing window // </summary> /// <param name= "hWnd" > window handle </param> // <param name= "type" > blinking type </param> /// <returns></returns> Public Static BOOL FlashWindowEx(IntPtr hWnd, Flashtype type) {Flashwinfo Finfo =NewFlashwinfo (); Finfo.cbsize = Convert.touint32 (marshal.sizeof (finfo)); Finfo.hwnd = hwnd;//Handle of the window to blink, the window can be open or minimizedFinfo.dwflags = (UINT) type;//Flashing typeFinfo.ucount = Uint32.maxvalue;//Flashes the number of WindowsFinfo.dwtimeout =0;The frequency, in milliseconds, of the blink of the window, or the default icon if the value is 0 returnFlashWindowEx (refFinfo); }
C # Windows API Application flashwindowex--method of implementing window flicker