【VB开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VB开源代码-as.frm的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
VERSION 5.00
Begin VB.Form Form1
Caption = "闪烁窗体"
ClientHeight = 2310
ClientLeft = 60
ClientTop = 345
ClientWidth = 3480
LinkTopic = "Form1"
ScaleHeight = 2310
ScaleWidth = 3480
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "停止闪烁"
Height = 495
Left = 840
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.Timer Timer1
Enabled = 0 'False
Left = 3000
Top = 960
End
Begin VB.CommandButton Command1
Caption = "开始闪烁"
Height = 495
Left = 840
TabIndex = 0
Top = 600
Width = 1215
End
Begin VB.Frame Frame1
Caption = "控制按钮"
Height = 1935
Left = 240
TabIndex = 2
Top = 120
Width = 2535
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim aab As Long '此变量用于存取窗口的句柄
Private Declare Function GetActiveWindow _
Lib "user32" () As Long '获取活动窗口的句柄
Private Declare Function FlashWindow _
Lib "user32" ( _
ByVal hwnd As Long, _
ByVal bInvert As Long _
) As Long
'hwnd 要闪烁显示的窗口的句柄
'binvert TRUE(非零)表示闪烁,FLASE返回最初状态
Private Sub Command1_Click()
Timer1.Enabled = True
'允许闪烁
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Call FlashWindow(aab, CLng(False))
'停止闪烁,返回最初状态
End Sub
Private Sub Form_Activate()
aab = GetActiveWindow()
'得到该窗口的句柄(一定要在activate事件或其后调用,否则获得的句柄无效)
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 500
'闪烁间隔时间
End Sub
Private Sub Timer1_Timer()
Dim lRtn As Long
'每执行一次便闪烁一次
lRtn = FlashWindow(aab, CLng(True))
End Sub
上一篇:
CreateTempFile.cpp
下一篇:
扛起年轻化大旗,哈弗F系玩转行业新风潮