请问怎样获取其他程序在通知栏的图标句柄

欢亮 2004-05-07 10:36:43
请问怎样获取通知栏图标句柄?(是其他程序的)
我自己想:应该先获取通知栏句柄吧。然后再获取其他程序的句柄吧。
可是怎么实现呢?
老实说我实验了好久,没成功。各位帮帮忙。有分送
...全文
26 3 点赞 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
supergreenbean 2004-05-07
可以考虑全局拦截API函数ShellNotifyIcon……
  • 打赏
  • 举报
回复
BitBlt 2004-05-07
通知拦是一个窗体,有句柄。时钟也有句柄。上面的图标是工具拦上的按钮,没有句柄。
  • 打赏
  • 举报
回复
onlineboy 2004-05-07
通知栏是哪一个?
如果是要获得程序和文件的系统图标的话,如下:

Public Const MAX_PATH = 260
Public Const SHGFI_DISPLAYNAME = &H200
Public Const SHGFI_EXETYPE = &H2000
Public Const SHGFI_SYSICONINDEX = &H4000 ' System icon index
Public Const SHGFI_LARGEICON = &H0 ' Large icon
Public Const SHGFI_SMALLICON = &H1 ' Small icon
Public Const ILD_TRANSPARENT = &H1 ' Display transContainer
Public Const SHGFI_SHELLICONSIZE = &H4
Public Const SHGFI_TYPENAME = &H400
Public Const BASIC_SHGFI_FLAGS = SHGFI_TYPENAME Or SHGFI_SHELLICONSIZE Or SHGFI_SYSICONINDEX Or SHGFI_DISPLAYNAME Or SHGFI_EXETYPE
Public Type SHFILEINFO
hIcon As Long
iIcon As Long
dwAttributes As Long
szDisplayName As String * MAX_PATH
szTypeName As String * 80
End Type
Public Declare Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" (ByVal pszPath As String, ByVal dwFileAttributes As Long, psfi As SHFILEINFO, ByVal cbSizeFileInfo As Long, ByVal uFlags As Long) As Long
Public Declare Function ImageList_Draw Lib "comctl32.dll" (ByVal himl&, ByVal i&, ByVal hDCDest&, ByVal X&, ByVal Y&, ByVal Flags&) As Long
Public Shinfo As SHFILEINFO


Public Function GetFileIcon(TempFileName As String) As String
'返回imagelist的Key
Dim hImgLarge As Long ' The handle to the system image list
Dim FileType As String

If TempFileName = "" Or Dir(TempFileName) = "" Then
GetFileIcon = "NonFile"
Exit Function
End If

hImgLarge& = SHGetFileInfo(TempFileName, 0&, Shinfo, Len(Shinfo), BASIC_SHGFI_FLAGS Or SHGFI_LARGEICON)
FileType = Left$(Shinfo.szTypeName, InStr(Shinfo.szTypeName, Chr$(0)) - 1)
If FileType = "应用程序" Then FileType = TempFileName
picLarge.Cls
ImageList_Draw hImgLarge&, Shinfo.iIcon, picLarge.hDC, 0, 0, ILD_TRANSPARENT

On Error Resume Next
GetFileIcon = imlIcon32.ListImages(FileType).Key
If Err.Number <> 0 Then
imlIcon32.ListImages.Add , "icon" & FileType, picLarge.Image
End If
On Error GoTo 0
GetFileIcon = "icon" & FileType

End Function
  • 打赏
  • 举报
回复
相关推荐
发帖
VB基础类
加入

7546

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2004-05-07 10:36
社区公告
暂无公告