473,508 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent: How to iterate all windows belonging to a particular process in C#

Hi,
I want to find all the windows created by a particular
process object and close them. Process class only
returns handle to Mainwindow and not other windows.
Furthermore closing mainwindow does not close all other
windows.

Can someone give pointers?
TIA,
Vinay
Nov 15 '05 #1
5 6683
Win32 API:
EnumWindows, EnumChildWindoms, GetWindowThreadProcessId

Brad Williams
"Vinay" <vi***********@rediffmail.com> wrote in message
news:01****************************@phx.gbl...
Hi,
I want to find all the windows created by a particular
process object and close them. Process class only
returns handle to Mainwindow and not other windows.
Furthermore closing mainwindow does not close all other
windows.

Can someone give pointers?
TIA,
Vinay

Nov 15 '05 #2
Thanks Brad.

Is there any functionality available in C#? I do not want
to use Interop

Vinay
-----Original Message-----
Win32 API:
EnumWindows, EnumChildWindoms, GetWindowThreadProcessId

Brad Williams
"Vinay" <vi***********@rediffmail.com> wrote in message
news:01****************************@phx.gbl...
Hi,
I want to find all the windows created by a particular
process object and close them. Process class only
returns handle to Mainwindow and not other windows.
Furthermore closing mainwindow does not close all other
windows.

Can someone give pointers?
TIA,
Vinay

.

Nov 15 '05 #3
Vinay,

If these are mdi children, I believe all you will have to do is to loop like
so:

foreach( Form f in this.MdiChildren )
{
IWinCommands iChild = (IWinCommands)f;
iChild.Save();
}

Hope this helps.
--
Glen Jones MCSD

"Vinay" <vi***********@rediffmail.com> wrote in message
news:04****************************@phx.gbl...
Thanks Brad.

Is there any functionality available in C#? I do not want
to use Interop

Vinay
-----Original Message-----
Win32 API:
EnumWindows, EnumChildWindoms, GetWindowThreadProcessId

Brad Williams
"Vinay" <vi***********@rediffmail.com> wrote in message
news:01****************************@phx.gbl...
Hi,
I want to find all the windows created by a particular
process object and close them. Process class only
returns handle to Mainwindow and not other windows.
Furthermore closing mainwindow does not close all other
windows.

Can someone give pointers?
TIA,
Vinay

.

Nov 15 '05 #4
Ussually it is achieved creating and mantaining a "Forms Collection" in some
shared Collection-Derived variable.
When each of your forms is loaded, you should add code to register itself in
the forms collection.

Good luck

"Vinay" <vi***********@rediffmail.com> escribió en el mensaje
news:04****************************@phx.gbl...
Thanks Brad.

Is there any functionality available in C#? I do not want
to use Interop

Vinay
-----Original Message-----
Win32 API:
EnumWindows, EnumChildWindoms, GetWindowThreadProcessId

Brad Williams
"Vinay" <vi***********@rediffmail.com> wrote in message
news:01****************************@phx.gbl...
Hi,
I want to find all the windows created by a particular
process object and close them. Process class only
returns handle to Mainwindow and not other windows.
Furthermore closing mainwindow does not close all other
windows.

Can someone give pointers?
TIA,
Vinay

.

Nov 15 '05 #5
You will probably need to enumerate all the windows.

There's a class here that can do that for you:

http://www.gotdotnet.com/Community/U...B-81F266CE8DE2

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://webblogs.asp.net/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
"Vinay" <vi***********@rediffmail.com> wrote in message
news:01****************************@phx.gbl...
Hi,
I want to find all the windows created by a particular
process object and close them. Process class only
returns handle to Mainwindow and not other windows.
Furthermore closing mainwindow does not close all other
windows.

Can someone give pointers?
TIA,
Vinay

Nov 15 '05 #6

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

Similar topics

2
21637
by: dont bother | last post by:
Hi Buddies, I am facing this problem and I dont know what to use as EOF in python: I want to read a file, and put all the individual words in a dictionary with their index: For example if the...
8
5210
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
7
2429
by: Gordon Smith | last post by:
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows Server 2003 production server. 3 of them work fine. I just installed the 4th one and it's Application_Start event is not...
16
2893
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
5
23980
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
3
2071
by: ricolee99 | last post by:
Hi everyone, I have a problem that i have been trying to solve for awhile. I'm given a code where the purpose is to create a general dataset mapper. Given any dataset, i have a class,...
0
1374
by: Dica | last post by:
hi does anybody know if it's possible to have a client belonging to their domain authenticate against our server belonging to another domain? we want to use something like integrated windows...
15
4741
by: Angelo | last post by:
Hi all, I'm using a FileSystemWatcher to monitor a directory. I want the FSW to pop up my already instantiated but invisible form. However, I'm running into some problems with this. 1) In...
0
1049
by: sanjayhire | last post by:
Hi All, I have just joined the forum. I need your help..As it's very urgent... How to identify a particular process is running on a server(Windows/Unix server) using VB program and since how...
0
7231
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,...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
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,...
1
7066
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...
0
5643
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,...
0
4724
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...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
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...

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.