|
|
|
Как захватить окно чужого приложения и встроить в своё окно?
|
|||
|---|---|---|---|
|
#18+
Есть функция SetParent, но фокус у того окна остаётся отдельным, а нужно, чтобы был общий фокус. Некоторые программы так делают, например, SumatraPDF в качестве плагина (не знаю, через SetParent, или нет). Код: pascal 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. Дополнительно: пытаюсь скрыть заголовок у Notepad, не получается. Если убрать SetParent, то окно Notepad вообще пропадает (остаётся мусор). ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 06.03.2021, 21:03 |
|
||
|
Как захватить окно чужого приложения и встроить в своё окно?
|
|||
|---|---|---|---|
|
#18+
registered а нужно, чтобы был общий фокус a) не тренироваться на примитивном "notepad.exe" *явно дёрнуто с интернетов: как встроить блокнот в свою программу b) вешать хук winproc (или цепочку оных) с отловом и передачей nc_activate окну по getancestor(hwnd, ga_root) с) даже с aсtivex - без гарантии, что получение фокуса его, дочерним, окном, активирует заголовок верхнего парента ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 07.03.2021, 23:48 |
|
||
|
Как захватить окно чужого приложения и встроить в своё окно?
|
|||
|---|---|---|---|
|
#18+
registered, https://alt.lang.delphi.narkive.com/dXS11op1/external-application-from-within-a-delphi-form скопировал сюда, вдруг код рабочий, тогда имеет смысл сохранить здесь на родном sql.ru External Application from within a Delphi Formвзял отсюда: https://alt.lang.delphi.narkive.com/dXS11op1/external-application-from-within-a-delphi-form Q: I know how to run an external application from within Delphi.. what I need to know is it possible to have an external program run inside a Delphi form? I use this very cumbersome application at work. Its a mainfraim emulator. There are at least 12 different screens I access numerous times a day. I thought that I could write a simple shell program with tabs so I could run the mainframe emulator within the shell and have different instances of the program for each tab. Is this possible with Delphi? Thanks, Dave A: It seems to work quite nicely. Here is a Demo - Followed by a few comments. Код: pascal 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. Under Win95 the LockWindowUpdate() prevents the App showing up as 'normal' just before it is Re-Parented This does not work under XP A workaround would be to start it minimized and then resize it WHILE DEBUGGING comment out the LockWindowUpdate Notice that the Slave App does not appear in the Taskbar - this may or may not be a problem Slave Apps do appear in the Task Manager under Win95 Under XP they appear in the list of Processes not Running Apps I have only (so far) tested this under Delphi using NotePad as the slave App. Also notice that the Delphi 'Host' loses focus when the Slave has focus. This can be spoofed by trapping WM_ACTIVATEAPP It would be an idea for someone else to give this code a once over, just in case I've slipped up somewhere. Hope this is useful ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 08.03.2021, 11:39 |
|
||
|
Как захватить окно чужого приложения и встроить в своё окно?
|
|||
|---|---|---|---|
|
#18+
P.S. добавил две вставочки Код: pascal 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 08.03.2021, 13:22 |
|
||
|
Как захватить окно чужого приложения и встроить в своё окно?
|
|||
|---|---|---|---|
|
#18+
А почему у моей не работает? Чтобы был общий фокус, нужно WS_CHILD, но нет меню. Если убрать ShowWindow(mHWnd, SW_MAXIMIZE), то будет мусор вместо заголовка и меню, и фокус не получает (вообще, а не по SetFocus). Если SetParent раньше, чем SetWindowLong, то тоже фокус не получает. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 08.03.2021, 17:48 |
|
||
|
Как захватить окно чужого приложения и встроить в своё окно?
|
|||
|---|---|---|---|
|
#18+
я,кстати, ошибся хендлом. и вообще, как оказалось "not WS_OVERLAPPEDWINDOW" достаточно Код: pascal 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 08.03.2021, 19:37 |
|
||
|
|

start [/forum/topic.php?fid=58&fpage=25&tid=2037539]: |
0ms |
get settings: |
9ms |
get forum list: |
14ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
49ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
30ms |
get tp. blocked users: |
1ms |
| others: | 233ms |
| total: | 355ms |

| 0 / 0 |
