初学汇编,写了个自动关闭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

《GetDlgItemInt函数功能说明如下:

Translates the text of a specified control in a dialog box into an integer value.

Remarks

The GetDlgItemInt function retrieves the text of the specified control by sending the control aWM_GETTEXT message. The function translates the retrieved text by stripping any extra spaces at the beginning of the text and then converting the decimal digits. The function stops translating when it reaches the end of the text or encounters a nonnumeric character.

The GetDlgItemInt function returns zero if the translated value is greater than INT_MAX (for signed numbers) or UINT_MAX (for unsigned numbers).


        sub    eax,1
        .if    eax == 0    ;倒计时为0,则程序退出
            invoke SendMessage,hWinMain,WM_CLOSE,0,0

《SendMessage函数功能说明如下:

Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.

To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use thePostMessage orPostThreadMessage function.

Remarks

When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).

Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage function to obtain a unique message for inter-application communication.

The system only does marshalling for system messages (those in the range 0 to (WM_USER-1)). To send other messages (those >=WM_USER) to another process, you must do custom marshalling.

If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, the system switches to that thread and calls the appropriate window procedure. Messages sent between threads are processed only when the receiving thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the message. However, the sending thread will process incoming nonqueued messages while waiting for its message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more information on nonqueued messages, seeNonqueued Messages.


        .endif
        invoke    SetDlgItemInt,hWinMain,IDC_COUNT,eax,FALSE

《 SetDlgItemInt函数功能说明如下:

Sets the text of a control in a dialog box to the string representation of a specified integer value.

Remarks

To set the new text, this function sends a WM_SETTEXT message to the specified control

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首页

FindWIndow函数功能说明如下:

Retrieves a handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows. This function does not perform a case-sensitive search.

To search child windows, beginning with a specified child window, use the FindWindowEx function.

Remarks

If the lpWindowName parameter is not NULL, FindWindow calls the GetWindowText function to retrieve the window name for comparison. For a description of a potential problem that can arise, see the Remarks for GetWindowText.


                .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

LoadIcon函数功能说明如下:

Loads the specified icon resource from the executable (.exe) file associated with an application instance.

Note  This function has been superseded by the LoadImage function.

Remarks

LoadIcon loads the icon resource only if it has not been loaded; otherwise, it retrieves a handle to the existing resource. The function searches the icon resource for the icon most appropriate for the current display. The icon resource can be a color or monochrome bitmap.

LoadIcon can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values. Use the LoadImage function to load icons of other sizes.


            invoke    SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
            
            invoke    SetTimer,hWnd,ID_TIMER,3000,NULL  ;每3秒钟就查找一次

SetTimer函数功能说明如下:

Creates a timer with the specified time-out value.

Remarks

An application can process WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.

The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter.

The timer identifier, nIDEvent, is specific to the associated window. Another window can have its own timer which has the same identifier as a timer owned by another window. The timers are distinct.

SetTimer can reuse timer IDs in the case where hWnd is NULL.

invoke    SetTimer,NULL,NULL,1000,addr _ProcTimer
            mov    idTimer,eax
        
        .elseif    eax == WM_CLOSE
            invoke    KillTimer,hWnd,ID_TIMER

KillTimer函数说明如下:

Destroys the specified timer.

Remarks

The KillTimer function does not remove WM_TIMER messages already posted to the message queue.


            invoke    KillTimer,NULL,idTimer
            invoke    EndDialog,hWnd,NULL

EndDialog函数说明如下:

Destroys a modal dialog box, causing the system to end any processing for the dialog box.

Remarks

Dialog boxes created by the DialogBox, DialogBoxParam, DialogBoxIndirect, and DialogBoxIndirectParam functions must be destroyed using the EndDialog function. An application calls EndDialog from within the dialog box procedure; the function must not be used for any other purpose.

A dialog box procedure can call EndDialog at any time, even during the processing of the WM_INITDIALOG message. If your application calls the function while WM_INITDIALOG is being processed, the dialog box is destroyed before it is shown and before the input focus is set.

EndDialog does not destroy the dialog box immediately. Instead, it sets a flag and allows the dialog box procedure to return control to the system. The system checks the flag before attempting to retrieve the next message from the application queue. If the flag is set, the system ends the message loop, destroys the dialog box, and uses the value in nResult as the return value from the function that created the dialog box.


            
        .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
}

自动关闭QQ迷你首页的小程序(加上自己的一些理解)相关推荐

  1. 用偷梁换柱法清除腾讯QQ迷你首页的方法

    用偷梁换柱法清除腾讯QQ迷你首页的方法 虽然百度HI已现身江湖,但由于习惯使然,大家一直还是喜欢用腾讯QQ作为即时通讯工具.方便之余,有一些朋友询问,能不能想办法清除腾讯QQ的迷你首页? 经过多次实践 ...

  2. 浅谈对腾讯云微信小程序解决方案服务端的理解(主要针对信道服务)

    浅谈对腾讯云微信小程序解决方案服务端的理解(主要针对信道服务) 参考文章: (1)浅谈对腾讯云微信小程序解决方案服务端的理解(主要针对信道服务) (2)https://www.cnblogs.com/ ...

  3. c++qq主界面_QQ小程序,一个被严重低估的超级流量池!错过你就亏大了

    不同于微信小程序上线时的火爆,于去年11月才上线的QQ小程序(又叫轻应用)就显得低调很多,很少见轻应用的通告,QQ中也很少见对用户使用轻应用的引导. 但是,如果你因此认为QQ轻应用不堪大用,那你很容易 ...

  4. php获取QQ音乐直链,微信小程序-获取QQ音乐直链

    获取QQ音乐直链-用于微信小程序 补充:以下方法获取的直链会有失效期,如果大家有嗅探等工具可以直接上QQ音乐网站获取资源的直链,此方法仅供参考. 问题起源: 最近在做小程序音频播放这一块的时候发现一个 ...

  5. 开发类似QQ农场的认养小程序大概需要多少成本?

    QQ农场大家都玩过吧,当年可是风靡全国,有的人半夜定闹钟去偷菜,可以看得出大家对于土地的热爱,但现在大家都在城市上班,没有土地可以满足大家的种植欲,如果有一款小程序可以满足呢?有的人已经发现了其中的商 ...

  6. 妈耶,一分钟就能给小程序加上消息推送功能!

    难吗 很多开发者都觉得微信小程序的模板消息推送功能太复杂,还得自己写很多后端和前端代码! 哎!是时候表演真正的"懒人"技术了!! 不要开发后端代码!不要写一大堆前端埋点!不要五分钟 ...

  7. 快速给小程序加上人性化的「添加到我的小程序」提示

    「添加到我的小程序」这个功能,能够极大地提升你的小程序用户存留率!在这里,我们将简单地通过3个步骤,快速给自己的小程序加入这个人性化的功能:引导用户进行添加收藏小程序! 下载安装代码 地址:https ...

  8. 安卓qq去小程序版本号与服务器不符,腾讯QQ竟然推出微信小程序版本 但是只能查看消息不能回复消息...

    腾讯QQ用户量不敌微信且逐年下降已经是不争的事实,越来越多的用户把微信当做日常通讯最主要的沟通工具. 腾讯QQ这边倒是也想着通过运营活动恢复昔日的辉煌,不过想要再次超过微信的话看起来也是不太可能的事儿 ...

  9. QQ 邀你上线小程序,官方生态能力持续赋能你的小程序

    你身边总有一些朋友,他们的表情包极其丰富,能时刻应对各种聊天场景. 表情包奇奇怪怪,可可爱爱,非常形象生动体现我们当下的心情,逐渐成为社交平台中不可或缺的一门「语言」.无论是微信还是 QQ,不仅支持添 ...

  10. 最新QQ和微信去水印小程序源码及搭建教程!

    准备材料 1.域名(需要备案) 2.随便一个服务器(需要安装宝塔) 3.安装Nginx或者Apache服务 4.安装数据库php5.6及以上版本,并且安装sg11插件(宝塔里面搜索sg11就可以看到) ...

最新文章

  1. 2017-2018-1 我爱学Java 第一周 作业
  2. pgsql 前10条_白沙湾南片区11条新建道路最新进度及建成时间,已建成一条!还有一条将通车...
  3. 《数据结构与算法》实验报告——快速排序
  4. Python生成列表的所有子集
  5. 归纳推理测试没做完_朋友买了1斤紫菜,2年还没吃完,我教他这样做,2个月就吃完了...
  6. 使用ANTLR4,用于代码镜像和基于Web的DSL的Primefaces扩展
  7. 学硕计算机考296算高分么,考研总分是多少算高分?考研340分是什么水平?
  8. 【剑指offer】面试题46. 把数字翻译成字符串(java)
  9. 订单扣款却又被系统删除?携程回应:酒店系统故障导致
  10. 阿里社交梦不灭,再推校园社交App,“Real如我”能成吗?
  11. charles都踩过哪些坑_野路子14年 不如“缠论”1年 收益翻20倍
  12. Jsp+Ssm+Mysql框架实现的手机WAP版外卖点餐系统
  13. 轻量化网络:ShuffleNet
  14. uwp - ContentDialog - 自定义仿iphone提示框,提示框美化
  15. openmp 第一次运行时间比较长_Android App 启动时间优化
  16. MTK平台download烧录大全
  17. 危险漫步_2006年糖尿病漫步-漫步之日
  18. c语言中可以使用setw函数吗,string和stringstream+setw()用法总结
  19. 基于[三星6818]I2C驱动开发的0.96寸oled屏
  20. 《AWR Adaptive Weighting Regression for 3D Hand Pose Estimation》研读与实践

热门文章

  1. admincp db.php,${discuz-admincp_db.php-vul} 命令执行漏洞 修复方案
  2. 矩阵的舒尔补(Schur complement)
  3. !$boo在php中什么意思,php前戏
  4. Prometheus监控 Blackbox_exporter黑盒监测
  5. DRAM发展年历——电容方向
  6. 联网下 计算机重启,电脑每次开机都要重启路由器才能上网的处理方法
  7. 极客学院Unity3D开发知识体系视频课程
  8. SQLServer@@FETCH_STATUS含义
  9. 资料分析-第一章-统计术语
  10. 最早的即时通讯软件哪一个,你知道吗?