win32中如何让程序在开机时就自动运行起来
比如如下程序:一个禁止QQ游戏运先的程序
;>>>>>>于2011年10月16日晚作:路独行
;>>>程序功能是发现QQ游戏就马上关闭。此程序运行半小时自动退出。
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib kernel32.lib
includelib user32.lib
.data
ClassCaption db "QufPanelWnd",0
szCaption db '启动',0
szText db '欢迎你使用',0
szText1 db '腾讯公司系统正在维护',0ah,0dh,'请关闭QQ游戏',0
szText2 db '重要提示',0
.data?
_Count dd ?
hWnd dd ?
.code
;>>>>>关闭监查的窗口
_FindQQ Proc
LOCAL @hWnd:dword
;pushad
inc _Count
invoke FindWindow,addr ClassCaption,0
push eax
.if eax != 0
invoke MessageBox,NULL,offset szText1,offset szText2,MB_OK
pop eax
invoke SendMessage,eax,WM_CLOSE,0,0
.endif
;popad
ret
_FindQQ endp
;>>>创建时钟,建立消息循环
_CloseQQgame proc
LOCAL @stMsg : MSG
pushad
mov _Count,1
invoke SetTimer,0,0,5000,addr _FindQQ ;>>每5秒自己检查有没有QQ运行
mov hWnd,eax
.While TRUE
.break .if _Count > 1000 ;运行半小时1800秒/5秒=360个5秒等半小时
invoke GetMessage,addr @stMsg,0,0,0
invoke TranslateMessage,addr @stMsg
invoke DispatchMessage,addr @stMsg
.endw
invoke KillTimer,NULL,hWnd
popad
ret
_CloseQQgame endp
;>>>>>程序的入口地址
start:
invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK
invoke _CloseQQgame
invoke ExitProcess,NULL
end start
请斑竹们指点
[培训]传播安全知识、拓宽行业人脉——看雪讲师团队等你加入!