Hi,
I need to enumerate windows and find the sum of the rect of all the windows
of a specific application. In C++, I use the APIs - 'EnumWindows ,
GetWindowRect and UnionRect to accomplish the same.
How to perform the above in c#? Is PInvoke the only way to do it or Is there
some inherent c# way? 5 6962
"HL" <HL@discussions .microsoft.com> wrote in message
news:6E******** *************** ***********@mic rosoft.com... Hi,
I need to enumerate windows and find the sum of the rect of all the windows of a specific application. In C++, I use the APIs - 'EnumWindows , GetWindowRect and UnionRect to accomplish the same.
How to perform the above in c#? Is PInvoke the only way to do it or Is there some inherent c# way?
Nothing that I know of except to add and remove each form from a collection
manually as they are created and destroyed. You could do this in a base form
and inherit from it. On the other hand EnumWindows does work pretty well in
C#.
Michael
HL,
..NET doesn't provide a method for enumerating windows of arbitrary
application in the system. An application can only enumerate its own
windows.
--
Stoitcho Goutsev (100) [C# MVP]
"HL" <HL@discussions .microsoft.com> wrote in message
news:6E******** *************** ***********@mic rosoft.com... Hi,
I need to enumerate windows and find the sum of the rect of all the windows of a specific application. In C++, I use the APIs - 'EnumWindows , GetWindowRect and UnionRect to accomplish the same.
How to perform the above in c#? Is PInvoke the only way to do it or Is there some inherent c# way?
Hi Goutsev,
Can you let me know how an application can enumerate its own windows?
"Stoitcho Goutsev (100) [C# MVP]" wrote: HL,
..NET doesn't provide a method for enumerating windows of arbitrary application in the system. An application can only enumerate its own windows.
--
Stoitcho Goutsev (100) [C# MVP]
"HL" <HL@discussions .microsoft.com> wrote in message news:6E******** *************** ***********@mic rosoft.com... Hi,
I need to enumerate windows and find the sum of the rect of all the windows of a specific application. In C++, I use the APIs - 'EnumWindows , GetWindowRect and UnionRect to accomplish the same.
How to perform the above in c#? Is PInvoke the only way to do it or Is there some inherent c# way?
If it is an MDI application, you can simply enumerate through the
MdiChildren collection.
foreach(Form f in this.MdiChildre n)
{
MessageBox.Show (f.Name);
}
--Brendon
"HL" <HL@discussions .microsoft.com> wrote in message
news:65******** *************** ***********@mic rosoft.com... Hi Goutsev,
Can you let me know how an application can enumerate its own windows? "Stoitcho Goutsev (100) [C# MVP]" wrote:
HL,
..NET doesn't provide a method for enumerating windows of arbitrary application in the system. An application can only enumerate its own windows.
--
Stoitcho Goutsev (100) [C# MVP]
"HL" <HL@discussions .microsoft.com> wrote in message news:6E******** *************** ***********@mic rosoft.com... > Hi, > > I need to enumerate windows and find the sum of the rect of all the > windows > of a specific application. In C++, I use the APIs - 'EnumWindows , > GetWindowRect and UnionRect to accomplish the same. > > How to perform the above in c#? Is PInvoke the only way to do it or Is > there > some inherent c# way?
HL,
Each controls (the form is control too) has Controls collection. There you
can get all windows (controls) that are direct children of the control.
Normally applications has one for which is the main form of the application
and you start from there. You need to write probably recursive methods that
enumerates all direct children of the form and then the children of the
children and so on.
If the application is MDI container you should probably start with the
MdiChildren collection and then you can go down to each mdi child's Controls
collection.
--
Stoitcho Goutsev (100) [C# MVP]
"HL" <HL@discussions .microsoft.com> wrote in message
news:65******** *************** ***********@mic rosoft.com... Hi Goutsev,
Can you let me know how an application can enumerate its own windows? "Stoitcho Goutsev (100) [C# MVP]" wrote:
HL,
..NET doesn't provide a method for enumerating windows of arbitrary application in the system. An application can only enumerate its own windows.
--
Stoitcho Goutsev (100) [C# MVP]
"HL" <HL@discussions .microsoft.com> wrote in message news:6E******** *************** ***********@mic rosoft.com... > Hi, > > I need to enumerate windows and find the sum of the rect of all the > windows > of a specific application. In C++, I use the APIs - 'EnumWindows , > GetWindowRect and UnionRect to accomplish the same. > > How to perform the above in c#? Is PInvoke the only way to do it or Is > there > some inherent c# way? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phillip N Rounds |
last post by:
I need to eumerate all available drives in a C# Windows Form application (
and then of course the directory tree, but that's not the problem)
My question is, how to I enumerate all the available drives?
My initial thought was along the lines of
DirectoryInfo di = new DirectoryInfo( "c:\\");
DirectoryInfo Root = new DirectoryInfo( di.Parent.Name.ToString() );
DirectoryInfo RootDrives = Root.GetDirectories();
|
by: Doug |
last post by:
In vb6, I could Enumerate windows with API calls. Is there an easier way in .net, or do I still need to use the api calls?
|
by: smichr |
last post by:
I see that there is a thread of a similar topic that was posted
recently ( enumerate with a start index ) but thought I would start a
new thread since what I am suggesting is a little different.
I posted a very similar item to python-dev, but they said to post it
here. Tutor also said that if anything is to be considered as PEP
worthy, it should be run through here first. So...here goes.
Whenever I use enumerate, I am doing so...
|
by: tom.andersen |
last post by:
What we want to do is send a message to all windows in our .net
application.
They all are based on System.Windows.Forms.Form, and we might have, say
5 of them open in our application at once. How would you either:
A) Enumerate over a collection of all top level windows, which we can
then do what we want like call begininvoke to tell each window that
they might like to close,
|
by: pa.singer |
last post by:
I have an MDIList menu item that I want to enumerate at run-time and
possibly change the text shown for some of the MDI children included in
that list. When I enumerate the collection for that menu item, none of
the open MDI child windows show in the list although they are clearly
there in the actual drop-down of the menu item. Does anyone know how I
can enumerate the menu item that contains the MDIList at run-time and
change the text...
| |
by: eight02645999 |
last post by:
hi,
i am using python 2.1. Can i use the code below to simulate the
enumerate() function in 2.3? If not, how to simulate in 2.1?
thanks
from __future__ import generators
def enumerate(sequence):
index = 0
for item in sequence:
yield index, item
|
by: James Stroud |
last post by:
I think that it would be handy for enumerate to behave as such:
def enumerate(itrbl, start=0, step=1):
i = start
for it in itrbl:
yield (i, it)
i += step
This allows much more flexibility than in the current enumerate,
tightens up code in many cases, and seems that it would break no
|
by: =?Utf-8?B?am1hZ2FyYW0=?= |
last post by:
I'm trying to get a list of user accounts on the local computer - the same
list you see when you are about to log in to Windows XP or Vista. This needs
to work on a home computer (not connected to a domain). It's for a parental
control app where I want the parent to be able to assign rules for each
child's account. I've tried using the Win32 API
LsaEnumerateAccountsWithUserRight with the SE_INTERACTIVE_LOGON_NAME
privilege, but it doesn't...
|
by: ShadowLocke |
last post by:
I've been searching for the past two days on how to enumerate only the visible windows on the desktop (ala Taskbar/Alt+Tab list) I am using EnumWindows to get the list of the windows and this is what I am currently using to filter:
if( (IsWindowVisible(hwnd) || IsIconic(hwnd)) && (GetWindowLong(hwnd, GWL_HWNDPARENT) == 0) && ( (((GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) == 0) && GetWindow(hwnd, GW_OWNER) == 0) ||...
|
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...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |