1

I have 2 applications, let's say App1 and App2. App1 have a console and a second window where some stuff is displayed. What i want to do is to be able to see the second window of App1 inside App2(Mirror the window in the second applicaiton)

I read some stuff about window handle but i'm not sure how to use it.Is it enough to just pass the handle of the window to App2?

Are there any other ways to do this mirroring thing?

  • 2
    Short answer: Yes! The values of `HWND` objects are unique across the system. Longer: What method will you be using to pass the `HWND` between apps? – Adrian Mole Dec 17 '19 at 11:27
  • 2
    To be more precise: At any moment, `HWND` values are unique across the system. But `DestroyWindow(HWND)` may recycle values. So after `App1` closes, its `HWND` may be reused by a new window. See [`IsWindow`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindow) documentation. – MSalters Dec 17 '19 at 11:37
  • 1
    Another way would be for App1 to pass the name and/or class-name of the window to App2 and then App2 can use `FindWindow()` or `FindWindowEx()` to get the handle. – Adrian Mole Dec 17 '19 at 11:41
  • @AdrianMole, I thought about Shared Memory Block. – Silviu Alexandru Dec 17 '19 at 12:03
  • 2
    @SilviuAlexandru `WM_COPYDATA` is very simple to use https://learn.microsoft.com/en-us/windows/win32/dataxchg/wm-copydata – Richard Critten Dec 17 '19 at 12:05

0 Answers0