资源介绍:
易语言清除托盘图标源码
资源作者:
三叶资源网
资源界面:
.版本 2
.支持库 spec
.程序集 窗口程序集_启动窗口
.程序集变量 m_OsVersion, 整数型
.程序集变量 m_Isx64, 逻辑型
.程序集变量 m_nDataOffset, 整数型
.程序集变量 m_nStrOffset, 整数型
.子程序 __启动窗口_创建完毕
m_OsVersion = _OsVersion ()
m_Isx64 = _Isx64 ()
.判断开始 (m_Isx64)
m_nDataOffset = 16
m_nStrOffset = 24
.默认
m_nDataOffset = 12
m_nStrOffset = 18
.判断结束
_RefreshTaskbarIcon ()
结束 ()
.子程序 _Isx64, 逻辑型
.局部变量 p_Address, 整数型
.局部变量 p_Bool, 整数型
p_Address = GetProcAddress (GetModuleHandle (“kernel32”), “IsWow64Process”)
.如果真 (p_Address = 0)
返回 (假)
.如果真结束
IsWow64Process (-1, p_Bool)
返回 (p_Bool ≠ 0)
.子程序 _RefreshTaskbarIcon
.局部变量 p_hWnd, 整数型
.判断开始 (m_OsVersion = 6) ' 因为没有XP,所以没有写
p_hWnd = _FindTrayWnd ()
.如果真 (p_hWnd > 0)
_EnumNotifyWindow (p_hWnd)
.如果真结束
.判断 (m_OsVersion > 6) ' 测试支持WIN7,WIN8,WIN10还没试
p_hWnd = _FindTrayWnd ()
.如果真 (p_hWnd > 0)
_EnumNotifyWindow (p_hWnd)
.如果真结束
调试输出 (“-------------------------------- 我是分割线 -------------------------------”)
p_hWnd = _FindNotifyIconOverflowWindow ()
.如果真 (p_hWnd > 0)
_EnumNotifyWindow (p_hWnd)
.如果真结束
.默认
返回 ()
.判断结束
.子程序 _EnumNotifyWindow
.参数 hWnd, 整数型
.局部变量 dwProcessId, 整数型
.局部变量 hProcess, 整数型
.局部变量 lAddress, 整数型
.局部变量 iNum, 整数型
.局部变量 i, 整数型
.局部变量 BButton, TBBUTTON
.局部变量 Bin, 字节集
.局部变量 data, TRAYDATA
.局部变量 TrayInfo, TRAYDATAEX
.局部变量 delete, 整数型, , "0",
iNum = SendMessageA (hWnd, #TB_BUTTONCOUNT, 0, 0) ' 数量
.如果真 (iNum > 0)
GetWindowThreadProcessId (hWnd, dwProcessId)
.如果真 (dwProcessId > 0)
hProcess = OpenProcess (#PROCESS_ALL_ACCESS, 0, dwProcessId)
.如果真 (hProcess ≠ 0)
lAddress = VirtualAllocEx (hProcess, 0, 4096, #MEM_COMMIT, #PAGE_READWRITE)
Bin = 取空白字节集 (1024)
.变量循环首 (0, iNum - 1, 1, i)
' 调试输出 (i)
SendMessageA (hWnd, #TB_GETBUTTON, i, lAddress) ' 获取TBBUTTON数据
ReadProcessMemory_BButton (hProcess, lAddress, BButton, 24, 0) ' 获取TBBUTTON结构
调试输出 (BButton.idBitMap, BButton.idCommand, BButton.fsState, BButton.fsStyle, BButton.dwData, BButton.iString)
' 本源码来自三叶资源网(www.sanye.cx)
.如果真 (BButton.dwData ≠ -1)
ReadProcessMemory_Bin (hProcess, BButton.dwData, Bin, 1024, 0)
' 调试输出 (Bin)
ReadProcessMemory_TRAYDATA (hProcess, BButton.dwData, data, 24, 0) ' 对这个结构不是很清楚,网上的版本太多了,然后OD找了下结构,也不明显,但是勉强可以用
调试输出 (data.hWnd, data.uID, data.uCallbackMessage, data.Reserved, data.hIcon)
' 本源码来自三叶资源网(www.sanye.cx)
TrayInfo.hWnd = data.hWnd
.如果真 (IsWindow (TrayInfo.hWnd) = 0) ' 判断窗口时候有效
加入成员 (delete, i)
.如果真结束
TrayInfo.idCommand = BButton.idCommand
TrayInfo.strFilePath = _W2A (取字节集中间 (Bin, 25 + m_nStrOffset, 520)) ' 这因为是unicode,所以长度*2 260*2
TrayInfo.strTile = _W2A (取字节集中间 (Bin, 25 + 520 + m_nStrOffset, 260)) ' 这里不是很清除长度是好多,麻烦
调试输出 (TrayInfo.hWnd, TrayInfo.idCommand, TrayInfo.strFilePath, TrayInfo.strTile)
.如果真结束
' 本源码来自三叶资源网(www.sanye.cx)
.变量循环尾 ()
' 删除图标操作
.计次循环首 (取数组成员数 (delete), i)
SendMessageA (hWnd, #TB_DELETEBUTTON, delete [i], 1)
.计次循环尾 ()
VirtualFreeEx (hProcess, lAddress, 4096, #MEM_RELEASE)
CloseHandle (hProcess)
.如果真结束
.如果真结束
.如果真结束
.子程序 _W2A, 文本型, 公开
.参数 Unicode, 字节集
.局部变量 p_len, 整数型
.局部变量 p_Ansi, 字节集
.局部变量 p_nUtf8, 整数型
.局部变量 p_nUnicode, 整数型
.如果真 (Unicode = { })
返回 (“”)
.如果真结束
p_len = 取字节集长度 (Unicode) ÷ 2
p_nUnicode = WideCharToMultiByte (#CP_ACP, 0, Unicode, p_len, { }, 0, 0, 0)
p_Ansi = 取空白字节集 (p_nUnicode)
WideCharToMultiByte (#CP_ACP, 0, Unicode, p_len, p_Ansi, p_nUnicode, 0, 0)
返回 (到文本 (p_Ansi))
.子程序 _FindTrayWnd, 整数型
.局部变量 p_hWnd, 整数型
p_hWnd = FindWindow (“Shell_TrayWnd”, 字符 (0))
.如果真 (p_hWnd = 0)
返回 (0)
.如果真结束
p_hWnd = FindWindowEx (p_hWnd, 0, “TrayNotifyWnd”, 字符 (0))
.如果真 (p_hWnd = 0)
返回 (0)
.如果真结束
p_hWnd = FindWindowEx (p_hWnd, 0, “SysPager”, 字符 (0))
.如果真 (p_hWnd = 0)
返回 (0) ' 本源码来自三叶资源网(www.sanye.cx)
.如果真结束
p_hWnd = FindWindowEx (p_hWnd, 0, “ToolbarWindow32”, 字符 (0))
.如果真 (p_hWnd = 0)
返回 (0)
.如果真结束
返回 (p_hWnd)
.子程序 _FindNotifyIconOverflowWindow, 整数型
.局部变量 p_hWnd, 整数型
p_hWnd = FindWindow (“NotifyIconOverflowWindow”, 字符 (0))
.如果真 (p_hWnd = 0)
返回 (0)
.如果真结束
p_hWnd = FindWindowEx (p_hWnd, 0, “ToolbarWindow32”, 字符 (0))
.如果真 (p_hWnd = 0)
返回 (0)
.如果真结束
返回 (p_hWnd)
.子程序 _OsVersion, 整数型, , [0]未知[1]Win95[2]Win98[3]WinME[4]WinNT[5]Win2000[6]WinXP[7]Win2003[8]Vista[9]win7[10]Win8[11]Win8.1[12]Win10
置入代码 ({ 83, 49, 192, 100, 139, 29, 24, 0, 0, 0, 100, 139, 13, 48, 0, 0, 0, 133, 201, 121, 32, 185, 0, 0, 83, 0, 57, 75, 88, 117, 4, 176, 1, 235, 113, 57, 75, 84, 117, 4, 176, 2, 235, 104, 57, 75, 124, 117, 99, 176, 3, 235, 95, 139, 153, 168, 0, 0, 0, 139, 137, 164, 0, 0, 0, 131, 249, 4, 119, 4, 176, 4, 235, 74, 131, 249, 5, 117, 27, 131, 251, 0, 117, 4, 176, 5, 235, 60, 131, 251, 1, 117, 4, 176, 6, 235, 51, 131, 251, 2, 117, 4, 176, 7, 235, 42, 131, 249, 6, 117, 7, 131, 251, 0, 117, 4, 176, 8, 235, 28, 131, 251, 1, 117, 2, 176, 9, 131, 251, 2, 117, 2, 176, 10, 131, 251, 3, 117, 2, 176, 11, 131, 251, 4, 117, 2, 176, 12, 91, 201, 195 })
返回 (0)
资源下载: