初学汇编,写了个自动关闭QQ迷你首页的小程序
我有3个QQ,每天都要登录,可是登录后,"腾讯网迷你首页"就会自动弹出,干扰了我的心情(呵呵~~只有会员才免遭此罪哦).于是,我编写了个程序:在10分钟内主动查找"腾讯网迷你首页",发现就把它关掉,不给它弹出的机会!于是,世界开始宁静了... ...10分钟后,这个小程序又自动退出了.以下是代码(已测试),希望大家批评指正:
;用定时器定时查找QQ迷你窗口,找到后就关闭它;
;如果10分钟内没有找到,则自动退出.
;作者:ONEPROBLEM
;===========================================
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
ID_TIMER equ 1
ICO_MAIN equ 1
DLG_MAIN equ 1
IDC_COUNT equ 100
.data?
hInstance dd ?
hWinMain dd ?
idTimer dd ?
.const
szCaption db '腾讯网迷你首页',0
;========================================================
.code
_ProcTimer proc _hWnd,uMsg,_idEvent,_dwTime ;定时器过程
pushad
invoke GetDlgItemInt,hWinMain,IDC_COUNT,NULL,FALSE
sub eax,1
.if eax == 0 ;倒计时为0,则程序退出
invoke SendMessage,hWinMain,WM_CLOSE,0,0
.endif
invoke SetDlgItemInt,hWinMain,IDC_COUNT,eax,FALSE
popad
ret
_ProcTimer endp
;====================================================================
_ProcDlgMain proc uses ebx edi esi,hWnd,uMsg,wParam,IParam
mov eax,uMsg
.if eax == WM_TIMER
mov eax,wParam
.if eax == ID_TIMER
invoke FindWindow,NULL,addr szCaption ;查找QQ首页
.if eax
mov hWnd,eax
invoke SendMessage,hWnd,WM_CLOSE,0,0
.endif
.endif
.elseif eax == WM_INITDIALOG
push hWnd
pop hWinMain
invoke LoadIcon,hInstance,ICO_MAIN
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
invoke SetTimer,hWnd,ID_TIMER,3000,NULL ;每3秒钟就查找一次
invoke SetTimer,NULL,NULL,1000,addr _ProcTimer
mov idTimer,eax
.elseif eax == WM_CLOSE
invoke KillTimer,hWnd,ID_TIMER
invoke KillTimer,NULL,idTimer
invoke EndDialog,hWnd,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcDlgMain endp
;=============================================================
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _ProcDlgMain,NULL
invoke ExitProcess,NULL
end start
;===================================================================================
;===================================================================================
;以下是.RC文件:
#include <resource.h>
#define DLG_MAIN 1 //对话框
#define ICO_MAIN 1
#define IDC_COUNT 100
ICO_MAIN ICON "1.ico"
DLG_MAIN DIALOG 50,50,120,60
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "守候者 SH1.0"
FONT 14,"宋体"
{
LTEXT "说明:1、这个小工具可以帮你\n关掉烦人的腾讯网迷你首页;",-1,8,5,100,22
LTEXT "2、程序将在10分钟后自动关闭。",-1,8,22,100,22
LTEXT "倒计时:",-1,30,43,35,10
LTEXT "600",IDC_COUNT,60,43,15,10
LTEXT "秒",-1,75,43,10,10
}
[[it] 本帖最后由 ONEPROBLEM 于 2008-7-13 11:11 编辑 [/it]]
[[it] 本帖最后由 ONEPROBLEM 于 2008-7-13 21:35 编辑 [/it]]
CloseQQ.rar
(3.91 KB)