473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 6679
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...

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.