TSPlugInterFace.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. // TSPlugInterFace.h : CTSPlugInterFace 的声明
  2. #pragma once
  3. #include "resource.h" // 主符号
  4. #include "TSPlug_i.h"
  5. #include "DXBind.h"
  6. #include "TSRuntime.h"
  7. #include "TSWindowsAPI.h"
  8. #include "TSMemoryAPI.h"
  9. #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
  10. #error "Windows CE 平台(如不提供完全 DCOM 支持的 Windows Mobile 平台)上无法正确支持单线程 COM 对象。定义 _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA 可强制 ATL 支持创建单线程 COM 对象实现并允许使用其单线程 COM 对象实现。rgs 文件中的线程模型已被设置为“Free”,原因是该模型是非 DCOM Windows CE 平台支持的唯一线程模型。"
  11. #endif
  12. // CTSPlugInterFace
  13. class ATL_NO_VTABLE CTSPlugInterFace :
  14. public CComObjectRootEx<CComSingleThreadModel>,
  15. public CComCoClass<CTSPlugInterFace, &CLSID_TSPlugInterFace>,
  16. public IDispatchImpl<ITSPlugInterFace, &IID_ITSPlugInterFace, &LIBID_TSPlugLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
  17. {
  18. public:
  19. CTSPlugInterFace()
  20. {
  21. }
  22. DECLARE_REGISTRY_RESOURCEID(IDR_TSPLUGINTERFACE)
  23. BEGIN_COM_MAP(CTSPlugInterFace)
  24. COM_INTERFACE_ENTRY(ITSPlugInterFace)
  25. COM_INTERFACE_ENTRY(IDispatch)
  26. END_COM_MAP()
  27. DECLARE_PROTECT_FINAL_CONSTRUCT()
  28. HRESULT FinalConstruct()
  29. {
  30. return S_OK;
  31. }
  32. void FinalRelease()
  33. {
  34. }
  35. public:
  36. DXBind gDxObj;
  37. TSWindowsAPI gWindowObj;
  38. TSMemoryAPI gMemoryObj;
  39. STDMETHOD(BindWindow)(LONG hwnd, BSTR display, BSTR mouse, BSTR keypad, LONG mode, LONG* nret);
  40. STDMETHOD(BindWindowEx)(LONG hwnd, BSTR display, BSTR mouse, BSTR keypad, BSTR publics, LONG mode, LONG* nret);
  41. STDMETHOD(UnBindWindow)(LONG* nret);
  42. STDMETHOD(KeyDown)(LONG vk_code, LONG* nret);
  43. STDMETHOD(KeyUp)(LONG vk_code, LONG* nret);
  44. STDMETHOD(KeyPress)(LONG vk_code, LONG* nret);
  45. STDMETHOD(LeftDown)(LONG* nret);
  46. STDMETHOD(LeftUp)(LONG* nret);
  47. STDMETHOD(LeftClick)(LONG* nret);
  48. STDMETHOD(MoveTo)(LONG x, LONG y, LONG* nret);
  49. STDMETHOD(FindPic)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR pic_name, BSTR delta_color, DOUBLE sim, LONG dir, VARIANT* intX, VARIANT* intY, LONG* nret);
  50. STDMETHOD(RightClick)(LONG* nret);
  51. STDMETHOD(RightDown)(LONG* nret);
  52. STDMETHOD(FindColor)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR color, DOUBLE sim, LONG dir, VARIANT* intX, VARIANT* intY, LONG* nret);
  53. STDMETHOD(RightUp)(LONG* nret);
  54. STDMETHOD(GetColor)(LONG x, LONG y, BSTR* RetStrColor);
  55. STDMETHOD(GetCursorShape)(BSTR* RetCursorShape);
  56. STDMETHOD(SetPath)(BSTR path, LONG* nret);
  57. STDMETHOD(TSGuardProtect)(LONG enable, BSTR type, LONG* nret);
  58. STDMETHOD(KeyPressStr)(BSTR key_str, LONG delay, LONG* nret);
  59. STDMETHOD(SendString)(LONG hwnd, BSTR str, LONG* nret);
  60. STDMETHOD(SendString2)(LONG hwnd, BSTR str, LONG* nret);
  61. STDMETHOD(KeyPressChar)(BSTR key_str, LONG* nret);
  62. STDMETHOD(KeyDownChar)(BSTR key_str, LONG* nret);
  63. STDMETHOD(KeyUpChar)(BSTR key_str, LONG* nret);
  64. STDMETHOD(GetCursorPos)(VARIANT* x, VARIANT* y, LONG* nret);
  65. STDMETHOD(MoveR)(LONG rx, LONG ry, LONG* rnet);
  66. STDMETHOD(Ver)(BSTR* retver);
  67. STDMETHOD(GetPath)(BSTR* retpath);
  68. STDMETHOD(MiddleClick)(LONG* nret);
  69. STDMETHOD(WheelDown)(LONG* nret);
  70. STDMETHOD(WheelUp)(LONG* nret);
  71. STDMETHOD(Capture)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR file, LONG* nret);
  72. STDMETHOD(CaptureJpg)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR file, LONG* nret);
  73. STDMETHOD(CapturePng)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR file, LONG* nret);
  74. STDMETHOD(LockInput)(LONG lock, LONG* nret);
  75. STDMETHOD(Ocr)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR color_format, FLOAT sim, BSTR* retstr);
  76. STDMETHOD(SetDict)(LONG index, BSTR file, LONG* nret);
  77. STDMETHOD(UseDict)(LONG index, LONG* nret);
  78. STDMETHOD(ClearDict)(LONG index, LONG* nret);
  79. STDMETHOD(FindStr)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, FLOAT sim, VARIANT* intX, VARIANT* intY, LONG* nret);
  80. STDMETHOD(FindStrFast)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, FLOAT sim, VARIANT* intX, VARIANT* intY, LONG* nret);
  81. STDMETHOD(GetNowDict)(LONG* nret);
  82. STDMETHOD(GetBasePath)(BSTR* retpath);
  83. STDMETHOD(IsDisplayDead)(LONG x1, LONG y1, LONG x2, LONG y2, LONG t, LONG* bret);
  84. STDMETHOD(FindPicEx)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR pic_name, BSTR delta_color, DOUBLE sim, LONG dir, BSTR* retstring);
  85. STDMETHOD(FindStrEx)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, DOUBLE sim, BSTR* retstring);
  86. STDMETHOD(FindStrFastEx)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, DOUBLE sim, BSTR* retstring);
  87. STDMETHOD(CaptureGif)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR file, LONG delay, LONG time, LONG* nret);
  88. STDMETHOD(DownCpu)(LONG rate, LONG* nret);
  89. STDMETHOD(SetKeypadDelay)(BSTR type, LONG delay, LONG* nret);
  90. STDMETHOD(SetMouseDelay)(BSTR type, LONG delay, LONG* nret);
  91. STDMETHOD(CmpColor)(LONG x, LONG y, BSTR color, DOUBLE sim, LONG* nret);
  92. STDMETHOD(SendStringIme)(BSTR str, LONG* nret);
  93. STDMETHOD(FindColorEx)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR color, DOUBLE sim, LONG dir, BSTR* retstring);
  94. STDMETHOD(EnumWindow)(LONG parent, BSTR title, BSTR class_name, LONG filter, BSTR* retstr);
  95. STDMETHOD(EnumWindowByProcess)(BSTR process_name, BSTR title, BSTR class_name, LONG filter, BSTR* retstring);
  96. STDMETHOD(EnumProcess)(BSTR name, BSTR* retstring);
  97. STDMETHOD(ClientToScreen)(LONG ClientToScreen, VARIANT* x, VARIANT* y, LONG* bret);
  98. STDMETHOD(FindWindow)(BSTR class_name, BSTR title, LONG* rethwnd);
  99. STDMETHOD(FindWindowByProcess)(BSTR process_name, BSTR class_name, BSTR title, LONG* rethwnd);
  100. STDMETHOD(FindWindowByProcessId)(LONG process_id, BSTR class_name, BSTR title, LONG* rethwnd);
  101. STDMETHOD(FindWindowEx)(LONG parent, BSTR class_name, BSTR title, LONG* rethwnd);
  102. STDMETHOD(GetClientRect)(LONG hwnd, VARIANT* x1, VARIANT* y1, VARIANT* x2, VARIANT* y2, LONG* nret);
  103. STDMETHOD(GetClientSize)(LONG hwnd, VARIANT* width, VARIANT* height, LONG* nret);
  104. STDMETHOD(GetForegroundFocus)(LONG* rethwnd);
  105. STDMETHOD(GetForegroundWindow)(LONG* rethwnd);
  106. STDMETHOD(GetMousePointWindow)(LONG* rethwnd);
  107. STDMETHOD(GetPointWindow)(LONG x, LONG y, LONG* rethwnd);
  108. STDMETHOD(GetProcessInfo)(LONG pid, BSTR* retstring);
  109. STDMETHOD(GetSpecialWindow)(LONG flag, LONG* rethwnd);
  110. STDMETHOD(GetWindow)(LONG hwnd, LONG flag, LONG* nret);
  111. STDMETHOD(GetWindowClass)(LONG hwnd, BSTR* retstring);
  112. STDMETHOD(GetWindowProcessId)(LONG hwnd, LONG* nretpid);
  113. STDMETHOD(GetWindowProcessPath)(LONG hwnd, BSTR* retstring);
  114. STDMETHOD(GetWindowRect)(LONG hwnd, VARIANT* x1, VARIANT* y1, VARIANT* x2, VARIANT* y2, LONG* nret);
  115. STDMETHOD(GetWindowState)(LONG hwnd, LONG flag, LONG* rethwnd);
  116. STDMETHOD(GetWindowTitle)(LONG hwnd, BSTR* rettitle);
  117. STDMETHOD(MoveWindow)(LONG hwnd, LONG x, LONG y, LONG* nret);
  118. STDMETHOD(ScreenToClient)(LONG hwnd, VARIANT* x, VARIANT* y, LONG* nret);
  119. STDMETHOD(SendPaste)(LONG hwnd, LONG* nret);
  120. STDMETHOD(SetClientSize)(LONG hwnd, LONG width, LONG hight, LONG* nret);
  121. STDMETHOD(SetWindowState)(LONG hwnd, LONG flag, LONG* nret);
  122. STDMETHOD(SetWindowSize)(LONG hwnd, LONG width, LONG height, LONG* nret);
  123. STDMETHOD(SetWindowText)(LONG hwnd, BSTR title, LONG* nret);
  124. STDMETHOD(SetWindowTransparent)(LONG hwnd, LONG trans, LONG* nret);
  125. STDMETHOD(SetClipboard)(BSTR value, LONG* nret);
  126. STDMETHOD(GetClipboard)(BSTR* retstring);
  127. STDMETHOD(DoubleToData)(DOUBLE value, BSTR* retstring);
  128. STDMETHOD(FloatToData)(FLOAT value, BSTR* retstring);
  129. STDMETHOD(IntToData)(LONG value, LONG type, BSTR* retstring);
  130. STDMETHOD(StringToData)(BSTR value, LONG type, BSTR* retstring);
  131. STDMETHOD(FindData)(LONG hwnd, BSTR addr_range, BSTR data, BSTR* retstring);
  132. STDMETHOD(FindDouble)(LONG hwnd, BSTR addr_range, DOUBLE double_value_min, DOUBLE double_value_max, BSTR* retstring);
  133. STDMETHOD(FindFloat)(LONG hwnd, BSTR addr_range, FLOAT float_value_min, FLOAT float_value_max, BSTR* retstring);
  134. STDMETHOD(FindInt)(LONG hwnd, BSTR addr_range, LONG int_value_min, LONG int_value_max, LONG type, BSTR* retstring);
  135. STDMETHOD(FindString)(LONG hwnd, BSTR addr_range, BSTR string_value, LONG type, BSTR* retstring);
  136. STDMETHOD(ReadData)(LONG hwnd, BSTR addr, LONG len, BSTR* retstring);
  137. STDMETHOD(OcrEx)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR color_format, DOUBLE sim, BSTR* retstring);
  138. STDMETHOD(ReadDouble)(LONG hwnd, BSTR addr, DOUBLE* retdouble);
  139. STDMETHOD(ReadFloat)(LONG hwnd, BSTR addr, FLOAT* retfloat);
  140. STDMETHOD(ReadInt)(LONG hwnd, BSTR addr, LONG type, LONG* retint);
  141. STDMETHOD(ReadString)(LONG hwnd, BSTR addr, LONG type, LONG len, BSTR* retstring);
  142. STDMETHOD(TerminateProcess)(LONG pid, LONG* bret);
  143. STDMETHOD(VirtualAllocEx)(LONG hwnd, LONG addr, LONG size, LONG type, LONG* bret);
  144. STDMETHOD(VirtualFreeEx)(LONG hwnd, LONG addr, LONG* bret);
  145. STDMETHOD(WriteDouble)(LONG hwnd, BSTR addr, DOUBLE v, LONG* bret);
  146. STDMETHOD(WriteFloat)(LONG hwnd, BSTR addr, FLOAT v, LONG* bret);
  147. STDMETHOD(WriteInt)(LONG hwnd, BSTR addr, LONG type, LONG v, LONG* bret);
  148. STDMETHOD(WriteString)(LONG hwnd, BSTR addr, LONG type, BSTR v, LONG* bret);
  149. STDMETHOD(WriteData)(LONG hwnd, BSTR addr, BSTR data, LONG* nret);
  150. STDMETHOD(IsBind)(LONG hwnd, LONG* nret);
  151. STDMETHOD(FindFloatEx)(LONG hwnd, BSTR addr_range, FLOAT float_value_min, FLOAT float_value_max, LONG step, LONG multi_thread, LONG mode, BSTR* retstring);
  152. STDMETHOD(FindDoubleEx)(LONG hwnd, BSTR addr_range, DOUBLE double_value_min, DOUBLE double_value_max, LONG step, LONG multi_thread, LONG mode, BSTR* retstring);
  153. STDMETHOD(FindIntEx)(LONG hwnd, BSTR addr_range, LONG int_value_min, LONG int_value_max, LONG type, LONG step, LONG multi_thread, LONG mode, BSTR* retstring);
  154. STDMETHOD(FindDataEx)(LONG hwnd, BSTR addr_range, BSTR data, LONG step, LONG multi_thread, LONG mode, BSTR* retstring);
  155. STDMETHOD(FindStringEx)(LONG hwnd, BSTR addr_range, BSTR string_value, LONG type, LONG step, LONG multi_thread, LONG mode, BSTR* retstring);
  156. STDMETHOD(GetModuleBaseAddr)(LONG hwnd, BSTR modulename, LONG* nret);
  157. STDMETHOD(GetCommandLine)(LONG hwnd, BSTR* retstring);
  158. STDMETHOD(AsmAdd)(BSTR asm_ins, LONG* nret);
  159. STDMETHOD(AsmCall)(LONG hwnd, LONG mode, LONG* nret);
  160. STDMETHOD(AsmClear)(LONG* nret);
  161. STDMETHOD(AsmCode)(LONG base_addr, BSTR* retstring);
  162. STDMETHOD(Assemble)(BSTR asm_code, LONG base_addr, LONG is_upper, BSTR* retstring);
  163. STDMETHOD(MatchPicName)(BSTR pic_name, BSTR* retstring);
  164. STDMETHOD(SetShowErrorMsg)(LONG show, LONG* nret);
  165. STDMETHOD(Reg)(BSTR reg_code, LONG type, LONG* nret);
  166. STDMETHOD(GetMachineCode)(BSTR* retstring);
  167. STDMETHOD(TSGuardProtectToHide)(LONG enble, LONG* nret);
  168. STDMETHOD(TSGuardProtectToHide2)(LONG enable, LONG* nret);
  169. STDMETHOD(TSGuardProtectToNP)(LONG enable, LONG* nret);
  170. STDMETHOD(Delay)(LONG mis, LONG* nret);
  171. STDMETHOD(FindStrS)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, DOUBLE sim, VARIANT* intX, VARIANT* intY, BSTR* retstring);
  172. STDMETHOD(FindStrFastS)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, DOUBLE sim, VARIANT* intX, VARIANT* intY, BSTR* retstring);
  173. STDMETHOD(FindStrExS)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, DOUBLE sim, BSTR* retstring);
  174. STDMETHOD(FindStrFastExS)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR string, BSTR color_format, DOUBLE sim, BSTR* retstring);
  175. STDMETHOD(FindPicS)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR pic_name, BSTR delta_color, DOUBLE sim, LONG dir, VARIANT* intX, VARIANT* intY, BSTR* retstring);
  176. STDMETHOD(FindPicExS)(LONG x1, LONG y1, LONG x2, LONG y2, BSTR pic_name, BSTR delta_color, DOUBLE sim, LONG dir, BSTR* retstring);
  177. STDMETHOD(SetDictPwd)(BSTR pwd, LONG* nret);
  178. STDMETHOD(SetPicPwd)(BSTR pwd, LONG* nret);
  179. STDMETHOD(LeftDoubleClick)(LONG* nret);
  180. STDMETHOD(FreeProcessMemory)(LONG hwnd, LONG* nret);
  181. STDMETHOD(TSDXGraphicProtect)(LONG enable, LONG* nret);
  182. STDMETHOD(TSDXKmProtect)(LONG enable, BSTR type, LONG* nret);
  183. STDMETHOD(CheckFontSmooth)(LONG* nret);
  184. STDMETHOD(DisableFontSmooth)(LONG* nret);
  185. STDMETHOD(GetScreenData)(LONG x1, LONG y1, LONG x2, LONG y2, LONG* RetAddr);
  186. STDMETHOD(EnableRealMouse)(ULONG enable, ULONG mousedelay, ULONG mousestep, ULONG* nret);
  187. STDMETHOD(EnableRealKeypad)(ULONG enable, ULONG* nret);
  188. STDMETHOD(MoveToEx)(ULONG x, ULONG y, ULONG w, ULONG h, BSTR* retstring);
  189. STDMETHOD(CheckUAC)(ULONG* nret);
  190. STDMETHOD(SetUAC)(ULONG enable, ULONG* nret);
  191. STDMETHOD(WaitKey)(ULONG vk_code, ULONG time_out, ULONG* nret);
  192. STDMETHOD(FindMultiColor)(ULONG x1, ULONG y1, ULONG x2, ULONG y2, BSTR first_color, BSTR offset_color, DOUBLE sim, ULONG dir, VARIANT* intX, VARIANT* intY, ULONG* nret);
  193. STDMETHOD(FindMultiColorEx)(ULONG x1, ULONG y1, ULONG x2, ULONG y2, BSTR first_color, BSTR offset_color, DOUBLE sim, ULONG dir, BSTR* retstring);
  194. STDMETHOD(SetSimMode)(ULONG mode, ULONG* nret);
  195. };
  196. OBJECT_ENTRY_AUTO(__uuidof(TSPlugInterFace), CTSPlugInterFace)