;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;FileName:TrayIcon.asm
;Function:Demothewaytoenumtheiconsinsystemtray
;Author:PurpleEndurer |
紫郢剑侠㊣(
PurpleEndurer@163.com)
;DevEnv:Win2000proSP4,MASM32v8
;
;log
;----------------------------------------------------------------------------------
;2007-09-29CanrununderWinXP
;2007-09-22Created!
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
.386
.modelflat,stdcall
optioncasemap:none
include/masm32/include/windows.inc
include/masm32/include/kernel32.inc
includelib/masm32/lib/kernel32.lib
include/masm32/include/user32.inc
includelib/masm32/lib/user32.lib
GetSysTrayToolBarHandleproto
EnumSubCtlproto:HWND,:LPARAM
GetSysTrayIconCountproto
EnumSysTrayIconproto
.data
g_szAppNamedb"EnumSysTrayIcon",0
g_szTaskBarClsdb"Shell_TrayWnd",0
g_szSysPagerClsdb"SysPager",0;WinXPneed!
g_szTrayNotifyWndClsdb"TrayNotifyWnd",0
g_szToolbarWindow32Clsdb"ToolbarWindow32",0
g_szFailGetSysTraydb"Failtogetsystemtray!",0
g_hSysTrayHANDLE?
g_dwTrayIconCountdword?
g_stTbButtonTBBUTTON<>
g_szIconTextdbMAX_PATHdup(?)
.code
start:
invokeGetSysTrayToolBarHandle
testeax,eax;.ifeax==NULL
.ifZERO?
invokeMessageBox,NULL,addrg_szFailGetSysTray,addrg_szAppName,MB_ICONERROR
.else
movg_hSysTray,eax
invokeEnumSysTrayIcon
.endif
invokeExitProcess,NULL
;////////////////////////////////////////////////////////////////////////////////
;Function:GetthehandleToolbarWindow32ofinsystemtray
;Shell_TrayWnd->TrayNotifyWnd->(WinXP:SysPager)->ToolbarWindow32
;Onput:iffaileax=NULL,elseeax=handle
;/////////////////////////////////////////////////////////////////////////////////
GetSysTrayToolBarHandleproc
;---Getthehandleoftaskbar
invokeFindWindow,addrg_szTaskBarCls,NULL
cmpeax,NULL
je@GetSysTrayToolBarHandleRet;fail
;HWNDFindWindowEx(
;HWNDhwndParent,//handletoparentwindow
;HWNDhwndChildAfter,//handletoachildwindow
;LPCTSTRlpszClass,//pointertoclassname
;LPCTSTRlpszWindow//pointertowindowname
;);
;---GetthehandleofTrayNotifyWndintaskbar
invokeFindWindowEx,eax,NULL,addrg_szTrayNotifyWndCls,NULL
cmpeax,NULL
je@GetSysTrayToolBarHandleRet
;---(WinXPOnly)Getthehandleofg_szSysPagerinTrayNotifyWnd
pusheax
invokeFindWindowEx,eax,NULL,addrg_szSysPagerCls,NULL
.if(eax==NULL)
popeax
.else
popedi
.endif
;---GetthehandleofToolbarWindow32inTrayNotifyWnd
invokeFindWindowEx,eax,NULL,addrg_szToolbarWindow32Cls,NULL
@GetSysTrayToolBarHandleRet:
ret
GetSysTrayToolBarHandleendp
;/////////////////////////////////////////////////////////////////////////////////
;Function:EnumtheChildwindowintaskbar
;/////////////////////////////////////////////////////////////////////////////////
EnumSubCtlprocprochWnd:HWND,lParam:LPARAM
invokeGetClassName,hWnd,addrg_szIconText,sizeofg_szIconText
invokeMessageBox,NULL,addrg_szIconText,addrg_szIconText,MB_OK
moveax,TRUE
ret
EnumSubCtlendp
;/////////////////////////////////////////////////////////////////////////////////
;Function:Getthecountoficoninsystemtray
;/////////////////////////////////////////////////////////////////////////////////
GetSysTrayIconCountproc
invokeSendMessage,g_hSysTray,TB_BUTTONCOUNT,0,0
movg_dwTrayIconCount,eax
ret
GetSysTrayIconCountendp
;///////////////////////////////////////////////////////////////////////
;Function:Enumtheiconinsystemtray
;///////////////////////////////////////////////////////////////////////
EnumSysTrayIconproc
localdwProcID,dwReaded:dword
localhProcess:HANDLE
localpMem:dword
invokeGetSysTrayIconCount
invokeGetWindowThreadProcessId,g_hSysTray,addrdwProcID
invokeOpenProcess,PROCESS_VM_OPERATIONorPROCESS_VM_READorPROCESS_VM_WRITE,FALSE,dwProcID
movhProcess,eax
invokeVirtualAllocEx,hProcess,NULL,1024,MEM_RESERVEorMEM_COMMIT,PAGE_READWRITE
movpMem,eax
xoreax,eax
.while(eax<g_dwTrayIconCount)
pusheax
invokeSendMessage,g_hSysTray,TB_GETBUTTON,eax,pMem
invokeReadProcessMemory,hProcess,pMem,addrg_stTbButton,sizeofg_stTbButton,addrdwReaded
invokeSendMessage,g_hSysTray,TB_GETBUTTONTEXT,g_stTbButton.idCommand,pMem
inceax;Iffail,thereturnvalueis-1
jz@F;Fail,skip
invokeReadProcessMemory,hProcess,pMem,addrg_szIconText,sizeofg_szIconText,addrdwReaded
invokeMessageBox,NULL,addrg_szIconText,addrg_szAppName,NULL
@@:
popeax
inceax
.endw
invokeVirtualFreeEx,hProcess,pMem,0,MEM_RELEASE
invokeCloseHandle,hProcess
ret
EnumSysTrayIconendp
endstart
分享到:
相关推荐
修正了0.0.0.2版中所显示系统托盘图标对应进程文件说明符中盘符可能不正确的问题。 详细信息在http://blog.csdn.net/purpleendurer/article/details/7269193
用于学习 16bit (DOS) / 32bit (Windows) MASM 汇编编程 也可用于实际的 C/C++-ASM 混合编程中汇编模块的开发 MASM 开发包的工具版本: MASM 6.15 Link 6.00 WinDbg 6.11 配套视频课程: 中国大学 MOOC 郑州大学 ...
汇编程序不会用?下这个教程吧,它将让你走出误区。。。
上回用MASM32编程使用了Windows系统提供的API函数:NetScheduleJobEnum()来枚举Windows计划任务(详见 MASM32编程枚举Windows计划任务,http://blog.csdn.net/Purpleendurer/archive/2009/11/05/4774148.aspx),...
MASM32教程MASM32教程MASM32教程MASM32教程MASM32教程MASM32教程MASM32教程
MASM32编程实现运行时自动提示要求以管理员帐户来运行的演示源代码和exe。详细信息请移步:http://blog.csdn.net/purpleendurer/article/details/54099224
详尽地讲解如何构建Win32汇编的编程环境
学习汇编的助手 汇编的小工具 masm32v8编程工具
masm32 SDK 软件包,一些工具的集合,很棒!
MASM32 V11版本中的kernel32.inc和Kernel32.lib中的Module32First / Module32Next and Process32First / Process32Next这两对函数信息存在bug。按照Microsoft MSDN,这两对函数的ANSI版本不是Module32FirstA / ...
建议用户使用08-11-08上传的最新版本Masm集成环境V1.5 http://download.csdn.net/source/760973 本版本采用《Intel汇编语言程序设计》一书附带光盘中的安装文件提取而成。仅去掉了此书中的示例程序,而其他文件(....
MASM32 Editor
::将此段代码复制到记事本,存为**.bat,将set Masm32Dir=后面的地址改为你的Masm32地址 ::使用方法:将.asm源文件拖到此批处理文件上,在源文件目录生成.exe文件 ::错误提示: ::1.Masm32编译器地址存在同名程序 ::...
MASM32是面向WIN32程序开发的,MASM611是面向DOS的,MASM32不使用中断调用了,而是使用微软的应用程序开发接口API和其他高级开发语言差不多了。而MASM611才是使用中断。 解压后大约15M 而压缩后才3.4M 分享学习的...
masm32安装时,如果是64位系统,会提示缺少几个lib文件,如kernel32.lib,user32.lib等
MASM32是国外的MASM爱好者自行整理和编写的一个软件包,目前最高版本为10.0版,MASM32并不是微软官方发布的软件,微软官方发布的软件最新版本也只到6.15版,微软发布的MASM系列版本从6.11版才开始支持windows编程,...
程序会按Time Protocol(RFC868)通过网络获取时间,如果在5秒钟内不能... 成功获取时间后,程序将尝试调整电脑系统时间。 更多信息可访问:http://blog.csdn.net/Purpleendurer/archive/2011/06/11/6537882.aspx
汇编语言程序环境搭建masm+debug64位 win10/7-附件资源
Masm32使用教程详细描述了Masm32基本使用方法、思路,本人认为较好