鼠标的移动键盘的输入这些都是操作系统控制的,咱们就是向系统发消息,直接通过系统控制程序。
应用程序 - 操作系统 -硬件串口(键盘鼠标之类的外部器件)
啥都不说啦先上代码![mw_shl_code=c,true]
#include "stdafx.h"
#include <Windows.h>
#include <string.h>
char* str = "ssss";
BOOL CALLBACK EnumChildWindowsProc(HWND hWnd, LPARAM lParam);
int _tmain(int argc, _TCHAR* argv[])
{
HWND ahwin = FindWindowA("#32770","恭喜你");//此处可以省略参数
HWND hWnd = ahwin;
if (ahwin == NULL)
{
MessageBoxA(0,"先打开啊哈C,弹出编译成功再打开啊!","再玩次",0);
}
else
{
SetWindowTextA(ahwin,"悲剧了!");
}
char WindowTitle[100] = { 0 };
GetWindowTextA(hWnd, WindowTitle, 100);
printf("%s\n", WindowTitle);
EnumChildWindows(hWnd, EnumChildWindowsProc, NULL); //获取父窗口的所有子窗口
return 0;
}
BOOL CALLBACK EnumChildWindowsProc(HWND hWnd, LPARAM lParam)
{
char WindowTitle[100] = { 0 };
GetWindowTextA(hWnd, WindowTitle, 100);
printf("%s\n", WindowTitle);
if (strstr(WindowTitle, "恭喜你编译成功!"))
{
if (SetDlgItemTextA(hWnd, 134, str) == NULL)
{
//此处无法修改static文本 希望各位啊哈朋友能够研究出来
}
UpdateWindow(hWnd);
}
else if (strstr(WindowTitle, "确定"))
{
SetWindowTextA(hWnd, "失败啦~~");
}
return true;
}
//vs编译通过!可能一些啊哈朋友没有vs,下面我提供编译好的程序![/mw_shl_code]
可能杀毒软件会报毒,因为我们是使用一个程序操作另一个程序.
|