在windows环境下更改某软件的窗口位置
2016-06-07 06:28
169 查看
#include<stdio.h> #include <stdlib.h> #include <Windows.h> #include <time.h> void main() { //HWND win = FindWindowA("TXGuiFoundation", "QQ");//获取窗口,TXGuiFoundation是通过spy软件获取的类名。 HWND win = FindWindowA("StandardFrame", "阿里旺旺");//获取窗口 int i = 0; while (1) { POINT pt; pt.x = pt.y = 0;//初始化 GetCursorPos(&pt);//获取位置 time_t ts; unsigned int num = time(&ts); srand(num);//随机数 int data = rand() % 4; switch (data) { case 0: SetWindowPos(win, NULL, pt.x-500, pt.y-500, 0, 0, 1);//1禁止改变窗口大小 break; //如果x+的话,是向右移动,如果y+的话是向下移动。 case 1: SetWindowPos(win, NULL, pt.x + 500, pt.y - 500, 0, 0, 1);//1禁止改变窗口大小 break; case 2: SetWindowPos(win, NULL, pt.x -500, pt.y + 500, 0, 0, 1);//1禁止改变窗口大小 break; case 3: SetWindowPos(win, NULL, pt.x + 500, pt.y + 500, 0, 0, 1);//1禁止改变窗口大小 break; default: break; } i++; if (i==1000) { //break;//跳出循环 return; } Sleep(100); } //system("taskkill /f /im iexplore.exe"); //MesaageBox(0,"发现病毒","") }
相关文章推荐
- sql server 字符串函数str()
- DCOS之docker各式文件系统简介
- LeetCode "Russian Doll Envelopes"
- Print nodes in a given range of BST
- 关于《精通移动App测试实战:技术、工具和案例》图书勘误信息
- flask-cors
- C#之五十 扫雷
- C#之五十 扫雷
- C#之五十 扫雷
- C#之四十九 游戏编程周每日总结
- C#之四十九 游戏编程周每日总结
- C#之四十九 游戏编程周每日总结
- shell 脚本的学习与使用(一)
- Nginx配置文件详细说明
- C#之四十八 俄罗斯方块设计
- Install Softwares
- C#之四十八 俄罗斯方块设计
- C#之四十八 俄罗斯方块设计
- One-to-Many|Many-to-One(双向+自身)
- jpa元注解