TSWindowsAPI.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. class TSWindowsAPI
  3. {
  4. public:
  5. TSWindowsAPI(void);
  6. ~TSWindowsAPI(void);
  7. public:
  8. int retstringlen;
  9. DWORD WindowVerion;
  10. DWORD IsEuemprosuccess;
  11. DWORD npid[MAX_PATH];
  12. bool TSEnumWindow(HWND parent, wchar_t* title, wchar_t* class_name, LONG filter, wchar_t* retstring, wchar_t* process_name = NULL);
  13. bool TSEnumWindowSuper(wchar_t* spec1, LONG flag1, LONG type1, wchar_t* spec2, LONG flag2, LONG type2, LONG sort, wchar_t* retstring = NULL);
  14. bool TSEnumProcess(wchar_t* name, wchar_t* retstring);
  15. bool TSClientToScreen(LONG hwnd, LONG& x, LONG& y);
  16. bool TSFindWindow(wchar_t* class_name, wchar_t* title, LONG& rethwnd, DWORD parent = 0);
  17. bool TSFindWindowByProcess(wchar_t* class_name, wchar_t* titl, LONG& rethwnd, wchar_t* process_name = NULL, DWORD Pid = 0);
  18. bool TSGetClientRect(LONG hwnd, LONG& x, LONG& y, LONG& x1, LONG& y1);
  19. bool TSGetClientSize(LONG hwnd, LONG& width, LONG& height);
  20. bool TSGetMousePointWindow(LONG& rethwnd, LONG x = -1, LONG y = -1);
  21. bool TSGetProcessInfo(LONG pid, wchar_t* retstring);
  22. bool TSGetWindow(LONG hwnd, LONG flag, LONG& rethwnd);
  23. bool GetProcesspath(DWORD ProcessID, wchar_t* process_path);
  24. bool TSGetWindowState(LONG hwnd, LONG flag);
  25. bool TSSendPaste(LONG hwnd);
  26. bool TSSetWindowSize(LONG hwnd, LONG width, LONG hight, int type = 0);
  27. bool TSSetWindowState(LONG hwnd, LONG flag, LONG rethwnd = 0);
  28. bool TSSetWindowTransparent(LONG hwnd, LONG trans);
  29. bool TSSetClipboard(wchar_t* values);
  30. bool TSGetClipboard(wchar_t* retstr);
  31. private:
  32. DWORD FindChildWnd(HWND hchile, wchar_t* title, wchar_t* classname, wchar_t* retstring, bool isGW_OWNER = false, bool isVisible = false, wchar_t* process_name = NULL);
  33. BOOL EnumProcessbyName(DWORD dwPID, LPCWSTR ExeName, LONG type = 0);
  34. int GetProcessNumber();//获取CPU个数
  35. // 时间格式转换
  36. __int64 FileTimeToInt64(const FILETIME& time);
  37. double get_cpu_usage(DWORD ProcessID); //获取指定进程CPU使用率
  38. DWORD GetMemoryInfo(DWORD ProcessID); //或者指定进程内存使用率
  39. };