goWindow.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Copyright 2016-2017 The go-vgo Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // https://github.com/go-vgo/robotgo/blob/master/LICENSE
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. #include "alert_c.h"
  11. #include "window.h"
  12. int aShowAlert(const char *title, const char *msg, const char *defaultButton,
  13. const char *cancelButton){
  14. int alert = showAlert(title, msg, defaultButton, cancelButton);
  15. return alert;
  16. }
  17. bool aIsValid(){
  18. bool abool = IsValid();
  19. return abool;
  20. }
  21. // int aFindwindow(char* name){
  22. // int z = findwindow(name);
  23. // return z;
  24. // }
  25. void aCloseWindow(void){
  26. CloseWin();
  27. }
  28. bool aSetHandle(uintptr handle){
  29. bool hwnd = setHandle(handle);
  30. return hwnd;
  31. }
  32. uintptr aGetHandle(){
  33. uintptr hwnd = getHandle();
  34. return hwnd;
  35. }
  36. uintptr bGetHandle(){
  37. MData mData = GetActive();
  38. #if defined(IS_MACOSX)
  39. return (uintptr)mData.CgID;
  40. #elif defined(USE_X11)
  41. return (uintptr)mData.XWin;
  42. #elif defined(IS_WINDOWS)
  43. return (uintptr)mData.HWnd;
  44. #endif
  45. }
  46. void aSetActive(const MData win){
  47. SetActive(win);
  48. }
  49. void active_PID(uintptr pid){
  50. MData win;
  51. #if defined(IS_MACOSX)
  52. // Handle to a AXUIElementRef
  53. win.AxID = AXUIElementCreateApplication(pid);
  54. #elif defined(USE_X11)
  55. win.XWin = (Window) pid; // Handle to an X11 window
  56. #elif defined(IS_WINDOWS)
  57. win.HWnd = (HWND) pid; // Handle to a window HWND
  58. #endif
  59. SetActive(win);
  60. }
  61. MData aGetActive(){
  62. MData mdata = GetActive();
  63. return mdata;
  64. }
  65. char* aGetTitle(){
  66. char* title = GetTitle();
  67. // printf("title::::%s\n", title );
  68. return title;
  69. }
  70. int32 aGetPID(void){
  71. int pid = WGetPID();
  72. return pid;
  73. }