|
@@ -6,126 +6,6 @@
|
|
|
#include <map>
|
|
|
#include <string>
|
|
|
|
|
|
-namespace GAssist
|
|
|
-{
|
|
|
- enum {
|
|
|
- GW_SMALL,
|
|
|
- GW_LARGE,
|
|
|
- GW_FULL,
|
|
|
- }GAME_WND;
|
|
|
- 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];
|
|
|
- extern int nGameWndType;
|
|
|
-
|
|
|
-
|
|
|
- typedef struct __GAME_HWNINFO__ {
|
|
|
- DWORD dwId; // 控件id;
|
|
|
- std::string strWinText; // 控件文本;
|
|
|
- std::string strClassName; // 控件类名;
|
|
|
- HWND hwnd; // 控件句柄;
|
|
|
- }GameHwnd, * pGameHwnd;
|
|
|
-
|
|
|
- // key_event的virtaul+scan
|
|
|
- extern std::map<byte, byte> vsKey;
|
|
|
-
|
|
|
- extern std::vector<GameHwnd> g_vtGameHwnd;
|
|
|
-
|
|
|
- typedef struct __GAMEWNDINFO__
|
|
|
- {
|
|
|
- unsigned long lProcId; // 进程ID;
|
|
|
- HWND hWnd; // 进程窗口句柄;
|
|
|
- std::string strGameRoleName; // 角色名称;
|
|
|
- std::string strGameZoon; // 区域;
|
|
|
- std::string strGameServer; // 服务站
|
|
|
- }GameWndInfo, * pGameWndInfo;
|
|
|
- extern std::vector<GameWndInfo> g_vtGameWndInfo;
|
|
|
-
|
|
|
- typedef struct __GAC__ {
|
|
|
- bool bLogin; // 登录状态;
|
|
|
- std::string strAccount; // 账号;
|
|
|
- std::string strPassword; // 密码;
|
|
|
- unsigned long lRoleNumber; // 角色ID;
|
|
|
- std::string strRoleName; // 角色名称;
|
|
|
- std::string strRoleType; // 角色类型:剑客、武师、医师、道士、术士;
|
|
|
- unsigned short nRoleLevel; // 角色等级;
|
|
|
- std::string strRoleZone; // 角色所在区:电信一区……;
|
|
|
- std::string strRoleSuit; // 角色所在服:忘忧谷;
|
|
|
- // 关联某进程信息;
|
|
|
- unsigned long lProcId; // 进程ID;
|
|
|
- HWND hWnd; // 进程窗口句柄;
|
|
|
- unsigned char wndType; // 窗口类型:0=小窗口、1=大窗口、2=全屏;
|
|
|
- std::string strWndText; // 窗口名称;
|
|
|
- __GAC__() {
|
|
|
- bLogin = false;
|
|
|
- lProcId = 0;
|
|
|
- lRoleNumber = 0;
|
|
|
- nRoleLevel = 0;
|
|
|
- wndType = 0;
|
|
|
- }
|
|
|
- }GUserInfo, * PGUserInfo;
|
|
|
- extern std::vector<GUserInfo> g_vtGUserInfo;
|
|
|
-
|
|
|
- extern void Init();
|
|
|
- extern void GetGameConfig();
|
|
|
- extern void ShowLog(const TCHAR* format, ...);
|
|
|
- extern BOOL CALLBACK EnumChildWindowCallBack(HWND hWnd, LPARAM lParam);
|
|
|
-
|
|
|
- // 根据进程名获取进程pid;
|
|
|
- extern DWORD GetProcessId(LPCTSTR lpProcessName = _T("Game.exe"));
|
|
|
- extern void GetAllProcessId(std::vector<DWORD> &vtPid, LPCTSTR lpProcessName = _T("Game.exe"));
|
|
|
- // 根据进程pid获取进程对应程序的窗口句柄;
|
|
|
- extern HWND GetProcessMainWnd(const DWORD &dwTagetProcessId, LPCTSTR lpTagetWndName = _T("大话水浒"));
|
|
|
- extern void GetAllProcessMainWnd(const std::vector<DWORD> &vtPid, std::vector<GameWndInfo> &vtGWnd, LPCTSTR lpTagetWndName = _T("大话水浒"));
|
|
|
- extern HWND GetProcessMainWnd(LPCTSTR lpProcessName = _T("Game.exe"), LPCTSTR lpTagetWndName = _T("大话水浒"));
|
|
|
- // 启动游戏;
|
|
|
- extern void StartGame(std::string strGameDir, int nStartCount = 5);
|
|
|
- // 单击事件;
|
|
|
- extern void MouseClick(HWND hwnd, POINT pt, BOOL bClientRect = TRUE);
|
|
|
- extern void MouseClick(HWND hwnd, unsigned int x, unsigned int y);
|
|
|
- extern void MouseDbClick(HWND, POINT pt);
|
|
|
- extern void MouseRClick(HWND hwnd, POINT pt, BOOL bClientRect = TRUE);
|
|
|
- extern void MouseRClick(HWND hwnd, unsigned int x, unsigned int y);
|
|
|
- extern void MouseRClick(HWND hwnd);
|
|
|
- // 移动鼠标;
|
|
|
- extern void MouseMove(HWND hwnd, POINT pt);
|
|
|
- extern void MouseMove(HWND hwnd, POINT ptStart, POINT ptEnd);
|
|
|
- extern void MouseMoveEx(HWND hwnd, POINT ptStart, POINT ptEnd);
|
|
|
- // 拖动鼠标;
|
|
|
- extern void DragMouse(HWND hwnd, POINT ptStart, POINT ptEnd);
|
|
|
- extern void SendKey(HWND hwnd, DWORD key, BOOL bCtrl = FALSE, BOOL bAtl = FALSE, BOOL bShift = FALSE);
|
|
|
- BOOL SetClipboardString(const char* lpString);
|
|
|
- CString GetClipboradString();
|
|
|
- // 截图;
|
|
|
- HBITMAP CopyDC2Bitmap(HWND hWnd, LPRECT lpRect);
|
|
|
- // 保存图片;
|
|
|
- BOOL SaveBitmap(HBITMAP hBitmpa, std::string strSavePath);
|
|
|
- //void SaveHwndToBmpFile(HWND hWnd, LPCTSTR lpszPath);
|
|
|
- void SaveHwndToBmpFile(HWND hWnd, std::string strSavePath);
|
|
|
- bool IsCoveredByOtherWindow(HWND hWnd);
|
|
|
-
|
|
|
- BOOL OpenImage(std::string strImag, cv::Mat &img);
|
|
|
- BOOL SetImgThreshold(cv::Mat &srcImg, cv::Mat &thresholdImg, long nThresholdVal, long nMaxThresholdVal, int type = 0);
|
|
|
- BOOL GetImgMatchtemplate(HWND hWnd, std::string strTempImg, RECT& rc, double lowestMatchValue = 0.900);
|
|
|
- BOOL GetImgMatchtemplate(std::string strSrcImg, std::string strTempImg, RECT &rc, double lowestMatchValue = 0.900);
|
|
|
- BOOL IsMatchIcon(HWND hWnd, std::string strTempImg, RECT srcRect, RECT& matchRect, double lowestMatchValue = 0.900);
|
|
|
- BOOL CropPicture(HWND hWnd, CRect rc, const char* szSaveName); // 剪裁图片;
|
|
|
- BOOL IsSimilarPicture(const char* szp1, const char* szp2, double lowestMatchValue = 0.99);
|
|
|
-
|
|
|
- // 职业大挑战;
|
|
|
- void ZhiYeDaTiaoZhan();
|
|
|
- BOOL IsWin10DpiScaleEanbled();
|
|
|
-};
|
|
|
-
|
|
|
namespace GameGlobal {
|
|
|
enum {
|
|
|
GW_SMALL,
|
|
@@ -166,6 +46,15 @@ namespace ImgAssist {
|
|
|
// 所有坐标,都是基于游戏窗口的相对坐标值;
|
|
|
// 游戏窗口:802*627
|
|
|
namespace GameAssist{
|
|
|
+ // 控件信息;
|
|
|
+ typedef struct __CTRL_INFO__ {
|
|
|
+ DWORD dwId; // 控件id;
|
|
|
+ std::string strWinText; // 控件文本;
|
|
|
+ std::string strClassName; // 控件类名;
|
|
|
+ HWND hwnd; // 控件句柄;
|
|
|
+ }CtrlInfo, * pCtrlInfo;
|
|
|
+ extern std::vector<CtrlInfo> g_vtCtrlInfo;
|
|
|
+
|
|
|
typedef struct __GAMEWNDINFO__
|
|
|
{
|
|
|
unsigned long lProcId; // 进程ID;
|
|
@@ -218,7 +107,8 @@ namespace GameAssist{
|
|
|
HWND GetProcessMainWnd(LPCTSTR lpProcessName = _T("Game.exe"), LPCTSTR lpTagetWndName = _T("大话水浒"));
|
|
|
// 获取所有指定进程名的进程主窗口;
|
|
|
void GetAllProcessMainWnd(const std::vector<DWORD>& vtPid, std::vector<GameWndInfo>& vtGWnd, LPCTSTR lpTagetWndName = _T("大话水浒"));
|
|
|
-
|
|
|
+ // 枚举指定进程的窗口;
|
|
|
+ extern BOOL CALLBACK EnumChildWindowCallBack(HWND hWnd, LPARAM lParam);
|
|
|
};
|
|
|
|
|
|
#endif // __ASSIST__
|