Assist.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef __ASSIST__
  2. #define __ASSIST__
  3. #pragma once
  4. namespace GAssist
  5. {
  6. //const TCHAR g_szGamePath[MAX_PATH] = _T("E:\\dhsh\\shdata\\Main.exe");
  7. const TCHAR g_szGamePath[MAX_PATH] = _T("D:\\tools\\dhsh\\shdata\\Main.exe");
  8. extern DWORD FindProcess(IN LPCSTR lpProName);
  9. extern HWND GetProHwnd(DWORD dwProcessId);
  10. extern BOOL CALLBACK EnumChildWindowCallBack(HWND hWnd, LPARAM lParam);
  11. typedef struct __GAME_HWNINFO__{
  12. DWORD dwId; // 控件id;
  13. std::string strWinText; // 控件文本;
  14. std::string strClassName; // 控件类名;
  15. HWND hwnd; // 控件句柄;
  16. }GameHwnd, *pGameHwnd;
  17. extern std::vector<GameHwnd> g_vtGameHwnd;
  18. typedef struct __GAC__ {
  19. bool bLogin; // 登录状态;
  20. std::string strAccount; // 账号;
  21. std::string strPassword; // 密码;
  22. unsigned long lRoleNumber; // 角色ID;
  23. std::string strRoleName; // 角色名称;
  24. std::string strRoleType; // 角色类型:剑客、武师、医师、道士、术士;
  25. unsigned short nRoleLevel; // 角色等级;
  26. std::string strRoleZone; // 角色所在区:电信一区……;
  27. std::string strRoleSuit; // 角色所在服:忘忧谷;
  28. // 关联某进程信息;
  29. unsigned long lProcId; // 进程ID;
  30. HWND hWnd; // 进程窗口句柄;
  31. unsigned char wndType; // 窗口类型:0=小窗口、1=大窗口、2=全屏;
  32. std::string strWndText; // 窗口名称;
  33. __GAC__() {
  34. bLogin = false;
  35. lProcId = 0;
  36. lRoleNumber = 0;
  37. nRoleLevel = 0;
  38. wndType = 0;
  39. }
  40. }GUserInfo, *PGUserInfo;
  41. extern std::vector<GUserInfo> g_vtGUserInfo;
  42. // 启动游戏;
  43. extern void StartGame(std::string strGameDir, int nStartCount = 5);
  44. // 单击事件;
  45. extern void MouseClick(HWND hwnd, POINT pt);
  46. extern void MouseClick(HWND hwnd, unsigned int x, unsigned int y);
  47. // 移动鼠标;
  48. extern void MouseMove(HWND hwnd, POINT pt);
  49. extern void MouseMove(HWND hwnd, POINT ptStart, POINT ptEnd);
  50. extern void MouseMoveEx(HWND hwnd, POINT ptStart, POINT ptEnd);
  51. // 拖动鼠标;
  52. extern void DragMouse(HWND hwnd, POINT ptStart, POINT ptEnd);
  53. // 截图;
  54. HBITMAP CopyDC2Bitmap(HWND hWnd, LPRECT lpRect);
  55. // 保存图片;
  56. BOOL SaveBitmap(HBITMAP hBitmpa, std::string strSavePath);
  57. void SaveHwndToBmpFile(HWND hWnd, LPCTSTR lpszPath);
  58. };
  59. #endif // __ASSIST__