1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #ifndef __ASSIST__
- #define __ASSIST__
- #pragma once
- #include <map>
- #include <string>
- #include <vector>
- #include <tchar.h>
- #include <windows.h>
- #include <Shlwapi.h>
- #pragma comment(lib,"Shlwapi.lib") /*需要加上此行才可以正确link,VC6.0*/
- #include <tlhelp32.h>
- namespace Assist {
- extern int titleBarHeight;
- extern int frameWidth;
- extern TCHAR g_szCurModuleFileName[MAX_PATH];
- extern TCHAR g_szCurModuleDir[MAX_PATH];
- extern TCHAR g_szCurModulePath[MAX_PATH];
- extern TCHAR g_szFna[_MAX_FNAME];
- extern TCHAR g_szExt[_MAX_EXT];
- extern TCHAR g_szAssistConfig[MAX_PATH];
- extern std::string g_strAppdir;
- extern std::string g_strGameDir;
- extern TCHAR g_szGameApp[MAX_PATH];
- typedef struct __HWNINFO__ {
- DWORD dwId; // 控件id;
- std::string strWinText; // 控件文本;
- std::string strClassName; // 控件类名;
- HWND hwnd; // 控件句柄;
- }WinInfo, * pWinInfo;
- extern std::vector<WinInfo> g_vtWndInfo;
- void Init();
- // 设置窗口前置;
- void SetWindowForeground(HWND hWnd);
- // 判断窗口是否前置;
- bool IsWindowForeground(HWND hWnd);
- bool StartApp(const TCHAR* szAppPath, const TCHAR* szAppArgs = NULL);
- void CloseProcess(LPCTSTR lpProcessName);
- // 根据进程名获取进程pid;
- DWORD GetProcessId(LPCTSTR lpProcessName );
- void GetAllProcessId(std::vector<DWORD>& vtPid, LPCTSTR lpProcessName);
- // 根据进程pid获取进程对应程序的窗口句柄;
- HWND GetProcessMainWnd(const DWORD& dwTagetProcessId, LPCTSTR lpTagetWndName);
- // 获取指定进程名的进程主窗口;
- HWND GetProcessMainWnd(LPCTSTR lpProcessName, LPCTSTR lpTagetWndName);
- // 根据进程pid获取进程类名对应的窗口;
- HWND GetClassNameWnd(const DWORD& dwTagetProcessId, LPCTSTR lpTagetClassName);
- // 根据进程pid获取进程窗口名对应的窗口;
- HWND GetWindowNameWnd(const DWORD& dwTagetProcessId, LPCTSTR lpTagetWindowName);
- // 获取符合要求的窗口进程;
- HWND GetWindowNameWnd(LPCTSTR lpProcessName, LPCTSTR lpTagetWindowName);
- void WriteTextLog(const TCHAR* format, ...);
- };
- #endif // __ASSIST__
|