1. 启动新 VisualBasic 标准 EXE 工程。 默认情况下创建 Form 1。
2. 向 Form 1 添加一个 CommandButton 控件。
3. 以下代码添加到 Form 1 的 GeneralDeclarations 部分:
Option Explicit
Private Declare Function FlashWindowEx Lib "user32" _
(FWInfo As FLASHWINFO) As Boolean
Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
Private Type FLASHWINFO
cbSize As Long ' size of structure
hWnd As Long ' hWnd of window to use
dwFlags As Long ' Flags, see below
uCount As Long ' Number of times to flash window
dwTimeout As Long ' Flash rate of window in milliseconds. 0 is default.
End Type
Const FLASHW_STOP = 0
Const FLASHW_CAPTION = 1
Const FLASHW_TRAY = 2
Const FLASHW_ALL = FLASHW_CAPTION Or FLASHW_TRAY
Const FLASHW_TIMER = 4
Const FLASHW_TIMERNOFG = 12
Private Sub Command1_Click()
Dim RetVal As Integer
Dim FWInfo As FLASHWINFO
' Fill the structure:
With FWInfo
.cbSize = 20
.hWnd = Me.hWnd
.dwFlags = FLASHW_ALL
.uCount = 5
.dwTimeout = 0
End With
' Allow time to cover the window:
Sleep (2000)
' call the function:
RetVal = FlashWindowEx(FWInfo)
End Sub
4. 启动应用程序并按 CommandButton 。 两秒延迟发生之前窗口闪烁任务栏中。 这样可以遮住窗口并观察行为中更改时间
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。