按情况修改批处理吧- #include <windows.h>
- #include <tchar.h>
- #include <iostream>
- #include <string>
- using namespace std;
- #pragma comment(lib, "user32.lib")
- HWND windowHandle;
- TCHAR previous[500];
- BOOL CALLBACK MyEnumProc(HWND hWnd, LPARAM lParam)
- {
- TCHAR title[500];
- string current;
- ZeroMemory(title, sizeof(title));
- //string strTitle;
- GetWindowText(hWnd, title, sizeof(title)/sizeof(title[0]));
- if (IsWindowVisible(hWnd) && (title[0]!='\\0')) printf("window %s\\n",title);
- ZeroMemory(previous,sizeof(previous));
- _tcscpy(previous,title);
- return TRUE;
- }
- void MyFunc(void) //(called by main)
- {
- EnumDesktopWindows(NULL,MyEnumProc, 0);
- }
- int main() {
- MyFunc();
- return 0;
- }
复制代码 批处理- @echo off
- set v=0
- start %1
- :wait
- ping 1.0.0.1 -n 1 >NUL -w 1000
- set /A %v+=1
- if %v% lss 30 goto :wait
- WindowsAPI.exe > results.txt
复制代码 把%1改成游戏就行了,另外可以直接从命令行启动
b% R9 r/ s3 _5 N z+ O3 o比如windowlst.bat calc |