473,834 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine if Form visible (to the eye)

How would you determine if a window(Form) is visible. By visible I mean
that you can currently see it, as apposed to Form.Visible. (which
returns True when the window sits behind other windows)

Using Form.Focused is no good because the form is still visible even
when its not focused.

--
Wal
http://www.vooose.com

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
6 12207
"vooose" <no****@microso ft.com> wrote in message
news:Oi******** ******@TK2MSFTN GP14.phx.gbl...
How would you determine if a window(Form) is visible. By visible I mean
that you can currently see it, as apposed to Form.Visible. (which
returns True when the window sits behind other windows)

Using Form.Focused is no good because the form is still visible even
when its not focused.


What happens if 90% of the form is hidden by another, in your definition of
visible does that count as visible or not?

Michael
Nov 17 '05 #2

Michael C wrote:
"vooose" <no****@microso ft.com> wrote in message
news:Oi******** ******@TK2MSFTN GP14.phx.gbl...
How would you determine if a window(Form) is visible. By visible I mean
that you can currently see it, as apposed to Form.Visible. (which
returns True when the window sits behind other windows)

Using Form.Focused is no good because the form is still visible even
when its not focused.


What happens if 90% of the form is hidden by another, in your definition of
visible does that count as visible or not?

I would think 90% would be a no-brainer - clearly it's still visible.
More interesting would be the case where only 1 pixel of the form was
visible, which is possible even if it were covered only by 2
overlapping rectangular windows that intersected one pixel in from the
corner. If the OP really just wanted to know "is any pixel of my form
not covered by another window, and within the desktop bounds", it
*might* be possible by checking the windows clipping region (although
I'm not sure what API's would tell you this for the NC area), but
certainly could be calculated by examining every other overlapping
window on the desktop. Why you'd need to know this I can't imagine!

Nov 17 '05 #3
Hi Michael. If any is visible then the IsReallyVisible func. should
return true.

The reason I need this is so: When the user clicks and holds the mouse
down, then releases I want to determine if they released OVER a certain
Form. It is returning true even when the form isnt "visible" - ie
another window sits above it

Regards

--
Wal
http://www.vooose.com

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4

vooose wrote:
Hi Michael. If any is visible then the IsReallyVisible func. should
return true.

The reason I need this is so: When the user clicks and holds the mouse
down, then releases I want to determine if they released OVER a certain
Form. It is returning true even when the form isnt "visible" - ie
another window sits above it

But that's an easier problem - now you just want to know which window
is at the top of the Z order given a certain x,y location. The Windows
API has a function "WindowFromPoin t" designed to do this, although it
isn't terribly clear from the doco that it only selects visible windows
at the top of the z order (I'm 99% certain it will always give the
topmost window, but it appears to also work for hidden windows, so
you'd have to test whether the window was actually visible).

Nov 17 '05 #5

wizof...@hotmai l.com wrote:
vooose wrote:
Hi Michael. If any is visible then the IsReallyVisible func. should
return true.

The reason I need this is so: When the user clicks and holds the mouse
down, then releases I want to determine if they released OVER a certain
Form. It is returning true even when the form isnt "visible" - ie
another window sits above it

But that's an easier problem - now you just want to know which window
is at the top of the Z order given a certain x,y location. The Windows
API has a function "WindowFromPoin t" designed to do this, although it
isn't terribly clear from the doco that it only selects visible windows
at the top of the z order (I'm 99% certain it will always give the
topmost window, but it appears to also work for hidden windows, so
you'd have to test whether the window was actually visible).


Actually scrap that - it definitely ignores hidden (and for that matter
disabled) windows, but it *might* return a window that is a child
window to the window you care about (e.g., a control on your form), so
you may need to handle this explicitly. Otherwise, comparing the HWND
returned from WindowFromPoint with your form's Handle property should
do the trick.

Nov 17 '05 #6
Yea sorry for this problem it is basically determining which form is on
top of the Z-order. I will check out WindowFromPoint and see how that
goes. I asked the original problem because I thought it was interesting
(and may be required later) - my bosses are always asking
'if the user aren't looking at a window then send them a notifier'

Well now the definition of 'aren't looking' comes into play. If the
window is minimised then its easy...if its got 50% showing you could
assume they r looking at it. It would be nice if there was a function
that returned the % of "visible" window or whether it was visible at all

Regards

--
Wal
http://www.vooose.com

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2215
by: Mark Loveless | last post by:
Back in my mainframe days a crash dump could be parsed by hand to reveal the application program running at crash time as well as the offset into said program, which combined with a extended program listing could be used to determine the partcular application program statement that killed the thing. I realize this is a totally different world, but is there a way at least to determine which form had control at access-decides-to-croak...
3
6829
by: Susan Bricker | last post by:
Greetings. I have three forms that are open at the same time. They are related and cascading. The first form (frmEventAdd) is the anchor. Each event can have many Trials. The second form is frmTrialInfo. Each Trial can have three Classes. The third form is frmClassInfo. These forms are used for update and adding new records. The user displays an event for update (frmEventAdd). Then clicks on a button to display the Trials for that event...
2
8446
by: LarryR | last post by:
I am trying to get a small form (using ShowDialog) to display over my main for as soon as the main for is displayed. I can't seem to find an accesible property or event that I can use to tell when my main form has finished loading. Anyone have a suggestion? To reply by email please remove x's from email address.
7
8586
by: Dave | last post by:
I have a button on Form1 that hides the form and displays Form2: Form2 myForm2 = new Form2(); myForm2.Show(); this.Hide(); After I do some work in Form2 I want to close it and redisplay Form1. I can close the form with: this.Close();
5
7502
by: | last post by:
How can i make my form invisible public class Form1 : System.Windows.Forms.Form static void Main() {
2
6977
by: Thelma Roslyn Lubkin | last post by:
If I close and reopen the form I lose its changes even if I set acSave to yes when closing. So I'm trying to keep the form open throughout but making it visible only when necessary. So how can I set the visible property from code in the calling form? thanks, --thelma
7
3500
by: clloyd | last post by:
I have a form that opens with an embedded subform visible for data entry of new data only. The form is based of a select query so I can show data from multiple tables for verification but the sub forms data is the actual table. I need the sub form to open with a blank record. I do not want to show previous entries because this is to be used to add new records only and not edit anything. Can anyone help.
4
2536
by: Essnell | last post by:
Hi, I'd like to know if it is possible to have a form containing a number of buttons that run query searches for showing availability of members on specific days as the only visible part of the access DB. This is for a small Museum and we don't want every one getting into the DB. I have tried as in my previous question 2 weeks ago, which I cannot find, DoMenuItem and RunComd without success. I really don't want to go down the road of lots...
2
1345
by: lenniekuah | last post by:
Hullo Good Friends, I need your help. Please Help me. I am trying to pass the name of the Calling FORM FRMSALES to the Loaded FORM FRMPOPUPCustomers so that FRMPOPUPCustomer will set the FRMSALES visible to FALSE. I am not sure how to do it. FRMPOPUPCustmer does not turn FRMSALES visible to FALSE. Here are the coding from Both FORMs:
0
9796
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10789
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10504
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10544
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7755
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.