473,785 Members | 2,307 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bring another window to back of my apllication when activated

1 New Member
Hi folks,
I got a requirement in my project where in when my application is activated another window should get activated and upon it my application should be present. Both should be in restored state not maximised.
To accomplish this, in the activated event of my MainForm I first activated the other window and then activated my window.
I've implemented the following piece of code in the activated event of my MainForm:

private void MainForm_Activa ted(object sender, EventArgs e) {
Process[] proc = Process.GetProc essesByName("IE XPLORE");
foreach(Process p in proc){
if(p.MainWindow Title.Equals("H i - Microsoft Internet Explorer")){
IntPtr hwnd = p.MainWindowHan dle;

SetForegroundWi ndow(hwnd);
ShowWindow((int )hwnd,1);
this.Activated -= new EventHandler(Ma inForm_Activate d);
SetForegroundWi ndow(this.Handl e);
ShowWindow((int )this.Handle,1) ;

this.Activated += new EventHandler(Ma inForm_Activate d);
return;
}
}
}

But this code is not working properly all the times.
When both the windows are minimised it works fine but when both are in restored state when my mainform is activated the other window comes to front but my MainForm never comes to front. Also, i am unable to minimize my application from taskbar as the activated event is getting fired andboth the windows are being restored. But, i am able to minimize from the minimize button on the form.

Can anybody propose me a solution with reasons(comment s)

Thanks in advance,
Pavan..
May 12 '06 #1
0 1764

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2626
by: Dai Ba Wong | last post by:
Hi: Currently I am having a problem with my webpage. My page consist of two frames, one consist of input text field and the other contains link for different pop-up windows. The problem follows: 1. At the beginning, focus is placed on an input text field of the first frame (so there's a blinking cursor on such field). 2. Then users click on a link of the second frame (thus focus is set
4
3910
by: Brian Kitt | last post by:
I don't know where to ask this question. If you know of a better place to ask it, please let me know. I have a main web page containing many links to detail pages. All detail links open with Target=xxx, so that I only have 1 detail page open at a time. In other words, if you click on detail line 1, it opens a new internet explorer window with detail page. You can then alt-tab back to the main window, click a detail line 2, and it...
0
311
by: sara | last post by:
I have a DB and all of a sudden the DB window is gone - and I can't get it back. Note: I am having trouble with my laptop keyboard and it seems to have a ghost so things "happen" when I'm not pressing the key (I think some key is sticking). So, I may have done something, but can't find what. All boxes are checked (Startup) as to allow to see everything. I hold the shift key down and the DB opens with a blank screen and F11 does...
7
11094
by: tom | last post by:
Hi, I want a listbox below a hidden calendar control. The problem is that the listbox will shadow the calendar when the calendar is visible. How can I bring the calendar from back to front? Thanks in advance.
9
21653
by: DraguVaso | last post by:
Hi, I want my application to bring another application to the Front. I thought best way to do this was by the Process-model: Dim c As Process = Process.GetCurrentProcess() Dim p As Process For Each p In Process.GetProcessesByName("EXTRA") If Left(p.MainWindowTitle, 4) = "Appl" Then 'Here I should be able to Bring the Process to the Front!!!
4
1912
by: Mark | last post by:
We have a windows 2000 server with terminal services activated. Users will connect using RDP and launch an application. Sometimes, users will minimize the application when they meant to minimize the terminal server session so they can get back to their desktop. The permissions set on the terminal server are such that they cannot maximize the application again. Since the application remembers it's location or state, the next user that...
13
22176
by: tochiromifune | last post by:
Hello The window.open method brings my window to the top only if it is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is there a new way in Mozilla/Firefox that I can ensure that this window comes to the top? Thank you for your help
2
6958
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. After entering these two items the user can either hit the enter key or press the submit button. The popup window will close and then those two text boxes in the original webpage will be filled in automatically. I would like to have the two...
3
3704
by: O.B. | last post by:
I have a form that shows another child form using the Show() operation. Since the child is modaless, I would like the option that when I click anywhere on the parent form that the parent form comes in front of the child. I added a callback in the parent form to call BringToFront() when I selected anywhere in the parent form, but it didn't work. Is there an option that I can specify in the child form to allow for this behavior?
0
9647
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
10357
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
10162
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
10101
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
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7509
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
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3665
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.