想用VB实现在windows下方的闪烁图标!

hanxiucao_mimosa 2003-03-03 04:12:48
我做了一个任务管理,因为需要在线刷新用户当前的任务,所以需要象QQ那样,放在window的最右下方(一登录就进入扫描状态),发现新的任务就闪烁,用户点击后就弹处我完成的任务处理界面,怎么实现呢?请赐教!
...全文
80 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wu_yongcai 2003-03-05
  • 打赏
  • 举报
回复
循环换一换图标不就有闪烁效果了吗,用得着这么兴师动众吗?
hanxiucao_mimosa 2003-03-03
  • 打赏
  • 举报
回复
图标倒是生成了,可是我的登录界面一关闭,这个图标也关闭了!我又怎么双击这个图标时弹出我的任务处理界面呢?请给点详细的说明吧!拜托了!谢谢!
hanxiucao_mimosa 2003-03-03
  • 打赏
  • 举报
回复
请问:你这段程序如何执行?
ClientDC 2003-03-03
  • 打赏
  • 举报
回复
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
sTip As String * 64
End Type
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const NIF_DOALL = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
Private Const WM_MOUSEMOVE = &H200
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_RBUTTONUP = &H205
Private sysIcon As NOTIFYICONDATA

With sysIcon
.cbSize = LenB(sysIcon)
.hwnd = Me.hwnd
.uID = 1&
.uFlags = NIF_DOALL
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = ImageList1.ListImages(6).Picture
.sTip = value & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, sysIcon '生成图标,可在时间控件中不停调用改变图标

Shell_NotifyIcon NIM_DELETE, sysIcon '删除
hanxiucao_mimosa 2003-03-03
  • 打赏
  • 举报
回复
谢谢你的详细介绍,可能是我没说清楚,我是希望界面象QQ那样注册一个图表在window任务栏上(和音量、输入法什么的在一起),如果有新的数据,图表就闪烁,我点开后就是任务处理界面了!你看看能解决不?
dbcontrols 2003-03-03
  • 打赏
  • 举报
回复
Step-by-Step Example
The following section describes how to flash a form while that form does not have the focus:


Start 16-bit or 32-bit Visual Basic 4.0, or, if it is already running, click New Project on the File menu.

Add a Timer control to the Form1 form.

Copy the following code to the Code window of the Form1 form:

Private Sub Form_GotFocus()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
Timer1.Interval = GetCaretBlinkTime()
Form2.Show
End Sub

Private Sub Timer1_Timer()
Success = FlashWindow(Form1.hwnd, 1)
End Sub



On the Insert menu, click Form to insert a second form into the project.

Copy the following code to the Code window of the Form2 form:

Private Sub Form_Click()
Form1.Timer1.Enabled = True
End Sub



On the Insert menu, click Module to insert a module into the project.

Copy the following code to the Code window of the Module1 module:

'Depending on what operating system you are using determines the
'correct function declares and variables. This is an example of
'conditional compilation.

#If Win32 Then
Declare Function FlashWindow Lib "user32" ( _
ByVal hwnd As Long, _
ByVal bInvert As Long) As Long

Declare Function GetCaretBlinkTime Lib "user32" () As Long

Dim Success As Long

#Else
Declare Function FlashWindow Lib "User" ( _
ByVal hwnd As Integer, _
ByVal bInvert As Integer) As Integer

Declare Function GetCaretBlinkTime Lib "User" () As Integer

Dim Success As Integer

#End If



On the Run menu, click Start or press the F5 key to start the program. Form1 will be in the foreground with Form2 in the background. Click anywhere in Form2; Form1's Caption Bar will flash until you click Form1.
dbcontrols 2003-03-03
  • 打赏
  • 举报
回复
API函数FlashWindow

1,485

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧