VB读取任务栏所有图标

来源:百度知道 编辑:UC知道 时间:2024/05/14 02:52:22

哇!!我用了API的DrawIcon函数利用句柄画出图标了!
1.建立工程
2.添加模块
3.form1中添加常常的Picture1控件和一个按钮
4.模块中写一下代码:
Public Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Public kang As Long
Public Function enumProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim ustr As