Is there a managed equivalent to the IsWindowVisible api call?

G

Garry Freemyer

Right now, I have my screensaver calling the IsWindowVisible api call from
user32.dll and it seems that there ought to be a way to determine if the
window is visible another way.

I found that I could test for the EXISTANCE of a window by trying to create
a graphics object from a handle to the preview window, but unlike the api
call, this will report the window as still in existance even if the preview
window is NOT visible to me, because I clicked on another tab.

I would like to eliminate the unmanaged call to this API because I want to
stick with managed code if possible so that I won't be waylaid by any future
possibility that this api call may become unavailable in the future.
 
T

Tom Porterfield

Right now, I have my screensaver calling the IsWindowVisible api call from
user32.dll and it seems that there ought to be a way to determine if the
window is visible another way.

I found that I could test for the EXISTANCE of a window by trying to create
a graphics object from a handle to the preview window, but unlike the api
call, this will report the window as still in existance even if the preview
window is NOT visible to me, because I clicked on another tab.

I would like to eliminate the unmanaged call to this API because I want to
stick with managed code if possible so that I won't be waylaid by any future
possibility that this api call may become unavailable in the future.

Wouldn't the Visible property on the form or control get you the
information you need?
 
G

Garry Freemyer

Using managed C#, the only control I can get from the handle is a graphics
control and it has no visible property per se. XP has a security thing that
prevents me from deriving a form from the handle. What is more, all of the
other visibility functions still report the graphic as visible when it is
not visible.

Any attempt by me to derive a control other than a graphic using managed C#
code, results in a null control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top