右下角工具栏推送提示图标的获取和删除
By
admin
at 2017-12-10 • 0人收藏 • 1258人看过
以win10推送图标为例:
import win; import process; deleteTrayIcon = function(){ //查找托盘窗口 var hwndTrayWnd = win.find("Shell_TrayWnd"); var hwndTrayNotifyWnd = win.findEx(hwndTrayWnd,0,"TrayNotifyWnd"); var hwndSysPager = win.findEx(hwndTrayNotifyWnd,0,"SysPager"); var hwndToolbarWindow32 = win.findEx(hwndSysPager,0,"ToolbarWindow32"); //打开任务栏进程 var _,pid = ..win.getThreadProcessId(hwndToolbarWindow32 ) var prcs = ..process( pid ) if( process().isWow64() ){ class TBBUTTON{ int iBitmap; int idCommand; BYTE fsState; BYTE fsStyle; BYTE bReserved[6]; ADDR dwData; addr iString; } } else { class TBBUTTON{ int iBitmap; int idCommand; BYTE fsState; BYTE fsStyle; BYTE bReserved[2]; ADDR dwData; addr iString; } } //在目标进程内分配内存,返回指针地址 var pTbButton = prcs.writeStruct(,::TBBUTTON()) var pRect = prcs.writeStruct(,::RECT()) var pText = prcs.malloc(256); for(i=0;9;1){ if( !::SendMessageInt(hwndToolbarWindow32,0x417/*_TB_GETBUTTON*/, i, pTbButton) ) continue; var tbButton = prcs.readStruct( pTbButton,::TBBUTTON() ); //读取外部进程的数据 ::SendMessageInt(hwndToolbarWindow32, 0x433/*_TB_GETRECT*/, tbButton.idCommand, pRect); var len = ::SendMessageInt(hwndToolbarWindow32, 0x42D/*_TB_GETBUTTONTEXT*/ , tbButton.idCommand, pText); if( len < 0 ) continue; var rc = prcs.readStruct( pRect,::RECT() ); var text = prcs.readString(pText,len); if( string.find(text,"Windows 10" ) ){ ::SendMessageInt(hwndToolbarWindow32, 0x416/*_TB_DELETEBUTTON*/,i,0) ; } } prcs.free(); }; deleteTrayIcon(); import fsys.wow64; import win.version; import process; if( win.version.isVistaLater ){ fsys.wow64.disableRedirection( function(){ process.execute("wusa","/uninstall /kb:3035583"); } ) }
登录后方可回帖