[comp.windows.ms] The 'root' or 'background' window in Windows

mikael@vall.dsv.su.se (Mikael Kindborg) (11/11/89)

------
There have been a few questions lately concerning the 'root'
or 'background' window in Windows. In fact, there exists a kind
of root window. In this text I will refer to this window as
the background window.

If you use Spy you will see that the background window has
the style WS_POPUP and the class name "desktop". I have tried
to get a handle to the background window by calling:
  FindWindow((LPSTR)"desktop", (LPSTR)NULL)
but this did not work (i.e NULL is returned).

I have also tried WindowFromPoint(), which works fine (this
is likely to be the method Spy uses). The problem is that
WindowFromPoint() is not very reliable. If a window is
maximized for instace, you can't access the background
window. Another approach is to use EnumWindows() and test
on the class name for each window. I have not tried this
method yet, so I don't know if it will work.

I would be very grateful for any suggestions on how to
access the background window in a reliable way.

Mikael Kindborg
Dep. of Computer Science
Univ of Stockholm
S-106 91 Stockholm, Sweden