0

I need to determine whether a window of interest is totally covered, partially covered, or not visible at all (e.g., minimized). Previous code here How can I tell if a Delphi control is currently visible? can be used to determine whether a form is completely or partially visible. How can I modify that Function IsMyFormCovered to discern between complete and partial visibility? That is, create a Function IsMyFormVisible(const MyWinHandle: THandle): integer; where the possible Result's are 1=completely visible, 2=partially visible, and 3=not visible at all.

dkjMusic
  • 11
  • 1
  • You could use `EnumWindows()` and `GetWindowRect()` to collect a list of HWNDs whose rects overlap your HWND's rect, then you could use [this code](https://community.idera.com/developer-tools/programming-languages/f/delphi-language/70024/how-to-obtain-a-z-order-list-of-desktop-windows-in-delphi) to check if any of those HWNDs have a lower zorder than your HWND – Remy Lebeau Sep 05 '19 at 03:19
  • If it were me, I'd make it a function that returns the percentage of visibility. But that's just me. I have no idea what your use-case is. – Jerry Dodge Sep 05 '19 at 03:45
  • If you try hard enough to understand what the code is doing, I'm sure you'll come up with an answer. Hint: you can compare (`EqualRgn`) the differential region with the region that represents your form's surface when the combined region is not null. – Sertac Akyuz Sep 05 '19 at 19:04

0 Answers0