功能
TrayIconMan可以列舉系統托盤區中的圖標,提示文本,及它們對應的程序,並控制它們的顯示和隱藏狀態。
有些網友反映,在windows xp 使用TrayIconMan來隱藏系統托盤圖標,圖標只是被轉到不活動的區域,並沒有真正地從托盤區消失。
研究發現在啓用了任務欄屬性中“隱藏不活動的圖標”功能的電腦中會出現此情況。
解決方法有兩種:
一種方法是停用“隱藏不活動的圖標”功能
另一種方法是啓用了“隱藏不活動的圖標”功能後,把需要讓其從托盤區消失的圖標設置爲“總是顯示”
再用TrayIconMan就可以讓相關圖標在托盤區隱藏起來了……
下載地址
http://down.51cto.com/data/330739
http://purpleendurer.ys168.com/ (\ myworks \ tools 中)
0.0.0.3 的改進
修正了0.0.0.2版中所顯示系統托盤圖標對應進程文件說明符中盤符可能不正確的問題。
問題分析
TrayIconMan在Windows XP運行時,會嘗試使用GetProcessImageFileName來獲取系統托盤圖標對應進程文件說明符。返回的對應文件說明符的形式是\Device\HardDiskVolume1\Windows\System32\svchost.exe,在轉換成C:\Windows\System32\svchost.exe這樣的格式時,0.0.0.2使用的代碼爲:
push sizeof szProcImage
lea eax, szProcImage
push eax
push hProc
call g_lpfnGetProcessImageFileName
test eax, eax
jz @GetProcImgFileSpecRet ;fail
lea eax, szProcImage
invoke locatePathName ;定位文件路徑名的首位置存在ebx中,如\Windows\System32\svchost.exe
push eax ; 文件路徑名的首位置在eax中,push for call lstrcpy()
;定位到\Device\HardDiskVolume1
dec eax
;取最後的數字計算盤符
mov al, byte ptr [eax]
sub al, '1' - 'C'
mov ah, ':'
mov word ptr g_szProcSpec, ax
push (offset g_szProcSpec)+2
;mov eax, offset g_szProcSpec
;inc eax
;inc eax
;push eax
call lstrcpy
這個方法在大多數情況下是正確的,但如果系統中存在沒有分配盤符的分區的話,那就符盤就可能不正確了。
在0.0.0.3中改用QueryDosDevice()來精確轉換。
附:微軟官網對於獲取進程對應文件說明符的 best results:
For the best results use the following table to convert paths.
Windows 2000 = GetModuleFileName()
Windows XP x32 = GetProcessImageFileName()
Windows XP x64 = GetProcessImageFileName()
Windows Vista = QueryFullProcessImageName()
Windows 7 = QueryFullProcessImageName()
Note: If you are not aware the API GetProcessImageFileName() returns a kernel DOS device path. You can use the following API to map the device paths to a Win32 format.
引自:http://msdn.microsoft.com/en-us/library/windows/desktop/ms684919(v=vs.85).aspx
文件信息
文件說明符 : F:\MASM32\pe-works\TrayIconMan\TrayIconMan.exe
屬性 : A---
數字簽名:否
PE文件:是
語言 : 中文(中國)
文件版本 : 0.0.0003
說明 : TrayIconMan | 系統托盤圖標管理員
版權 : PurpleEndurer
產品版本 : 0.0.0003
產品名稱 : TrayIconMan
公司名稱 : PurpleEndurer | 紫郢劍俠㊣
合法商標 : PurpleEndurer
內部名稱 : TrayIconMan
源文件名 : TrayIconMan
創建時間 : 2012-2-17 21:7:20
修改時間 : 2012-2-17 22:5:22
大小 : 8704 字節 8.512 KB
MD5 : d7b0c3b62155b15543fa87a456ca34bf
SHA1: 9BEB81EFAA04A69CF02713D7766FF9BAD62EBA83
CRC32: 8ffff234