6

I am creating window inside my program, then sending HWND of this window to another application. Will drawing on window's HDC be valid for another process?

Sergey
  • 685
  • 2
  • 8
  • 30
  • See [Thread affinity of user interface objects, part 1: Window handles](https://devblogs.microsoft.com/oldnewthing/20051010-09/?p=33843) and [Thread affinity of user interface objects, part 2: Device contexts](https://devblogs.microsoft.com/oldnewthing/20051011-10/?p=33823). – IInspectable Feb 10 '23 at 09:26

2 Answers2

5

Windows are owned by other windows, not by processes. You can draw to any HWND on your desktop (at least if the window has the same integrity -- I'm not sure what happens if they don't).

Web browsers that host plug-ins or tabs in a separate process generally make use of this functionality.

Gabe
  • 84,912
  • 12
  • 139
  • 238
2

Unfortunately you can do this.

Richard Schneider
  • 34,944
  • 9
  • 57
  • 73