Stay on top of main application window but not topmost

I have a dialog based application, and I'm using Chris Maunder's 
CProgressWnd to occasionally pop up a progress window.

When the CProgressWnd is created it disables my main application dialog 
window and uses the style WS_EX_TOPMOST to stay on top of it.

The problem is that WS_EX_TOPMOST causes the progress window to stay on top 
of ALL other applications' windows. What I really want is for the 
CProgressWnd to stay on top of my main dialog window BUT NOT stay on top of 
any other applications' windows.

That means that other applications can be started up and my application and 
its progress window will disappear beneath them - then when I switch back to 
my own application its window will be brought to the front with the progress 
dialog appearing on top of it.

Any ideas how I can do this?

0
null601 (11)
4/25/2008 10:46:45 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
451 Views

Similar Articles

[PageSpeed] 15

Here's something you could try.  Start the dialog from mainframe and make 
sure that  mainframe is it's parent.  Take away the WS_EX_TOPMOST style. 
When you want to make sure users see the dialog in your program you could 
pop it to the top using:

pDlg->SetForegroundWindow();
pDlg->BringWindowToTop();

Like in a case where you want to alert the user that the process completed.

Tom

"Richard" <null@null.co.uk> wrote in message 
news:ffqdndnxxaEKK4zVnZ2dnUVZ8rednZ2d@brightview.com...
>I have a dialog based application, and I'm using Chris Maunder's 
>CProgressWnd to occasionally pop up a progress window.
>
> When the CProgressWnd is created it disables my main application dialog 
> window and uses the style WS_EX_TOPMOST to stay on top of it.
>
> The problem is that WS_EX_TOPMOST causes the progress window to stay on 
> top of ALL other applications' windows. What I really want is for the 
> CProgressWnd to stay on top of my main dialog window BUT NOT stay on top 
> of any other applications' windows.
>
> That means that other applications can be started up and my application 
> and its progress window will disappear beneath them - then when I switch 
> back to my own application its window will be brought to the front with 
> the progress dialog appearing on top of it.
>
> Any ideas how I can do this?
> 

0
tom.nospam (3240)
4/25/2008 1:43:46 PM
"Tom Serface" <tom.nospam@camaswood.com> wrote in message 
news:7F174A3C-4847-4167-9B2F-1F7A1711A6F4@microsoft.com...
> Here's something you could try.  Start the dialog from mainframe and make 
> sure that  mainframe is it's parent.  Take away the WS_EX_TOPMOST style. 
> When you want to make sure users see the dialog in your program you could 
> pop it to the top using:
>
> pDlg->SetForegroundWindow();
> pDlg->BringWindowToTop();
>
> Like in a case where you want to alert the user that the process 
> completed.
>

Thanks Tom. Unexpectedly I found that just removing WS_EX_TOPMOST from 
CProgressWnd seems to have had the desired effect.

This seems to be due to a check in CProgressWnd where if its parent window 
(my application dialog window) gets the focus, then CProgressWnd immediately 
grabs the focus itself. This has the effect of always popping the progress 
window above the main dialog window, and without the need for it to be a 
"topmost" window.

0
null601 (11)
4/26/2008 9:47:21 AM
That works, however it kind of works around the idea of a non-modal window, 
but if it has the effect you want in your program that is the most important 
thing.  I also don't like windows that force their way to the top (like Task 
Manager for example).  At least with the TM you can minimize it :o)

Tom

"Richard" <null@null.co.uk> wrote in message 
news:AMidnQI-3YOtZ4_VRVnytAA@brightview.com...
>
> "Tom Serface" <tom.nospam@camaswood.com> wrote in message 
> news:7F174A3C-4847-4167-9B2F-1F7A1711A6F4@microsoft.com...
>> Here's something you could try.  Start the dialog from mainframe and make 
>> sure that  mainframe is it's parent.  Take away the WS_EX_TOPMOST style. 
>> When you want to make sure users see the dialog in your program you could 
>> pop it to the top using:
>>
>> pDlg->SetForegroundWindow();
>> pDlg->BringWindowToTop();
>>
>> Like in a case where you want to alert the user that the process 
>> completed.
>>
>
> Thanks Tom. Unexpectedly I found that just removing WS_EX_TOPMOST from 
> CProgressWnd seems to have had the desired effect.
>
> This seems to be due to a check in CProgressWnd where if its parent window 
> (my application dialog window) gets the focus, then CProgressWnd 
> immediately grabs the focus itself. This has the effect of always popping 
> the progress window above the main dialog window, and without the need for 
> it to be a "topmost" window.
> 

0
tom.nospam (3240)
4/26/2008 3:09:57 PM
Reply:

Similar Artilces:

Upgrading to 9.0 on Windows Server 2003 64bit Edition
We are upgrading from 7.0 to 9.0. We have new SQL Servers on which we will perform the upgrade and move into production once complete replacing our existing servers. These SQL Servers are running Windows Server 2003 Enterprise x64 Edition. When attempting to install either GP v7.0 or v7.5 the error message "The image file ...\CDSetup.exe is valid, but is for a machine type other than the current machine." is presented and the installation script will not initialize. Is it possible to install GP 7.0 or 7.5 on the 64bit version of Windows Server 2003 or must we install the 32 bit v...

Visio 2007, Vista 64, VISIO.EXE 32 stays loaded, 100% CPU
Whenever I run Visio 2007 under Vista 64, it starts a process, VISIO.EXE 32 which takes about 50% of the CPU. Sometimes it starts two copies and then it takes 100%. I used this visio under XP and it did not do this. I have all the MS patches in as well as everything from Lenovo for the Thinkpad. It is running Core 2 Duo with 3 Gig of ram. ...

Do I need DSClient to run Exchange 5.5 on an NT4.0 box in Windows 2003 Native Mode ADS?
Good Evening, I am in the process of migrating my WinNT4.0 domain and Exchange 5.5 Org to Windows 2003 ADS/Exchange 2003. I know best practice is to change the domain to Native mode, but how does this affect my NT4.0 server running 5.5? Do I need to simply load the DSClient onto the server? I should also note that we did an inplace upgrade from NT 4.0. This is a single domain environment. As long as you no longer have NT 4.0 BDCs you should be able to move to native mode. Your NT 4.0 server running E55 will not be affected (unless of course it is also a BDC). It is a good idea to...

Exchange 5.5 in Windows 2000 Domain
HI I am looking for any advise I can get on this subject, or any references you may have. Basically I have an NT4 PDC that currently has Exchange 5.5 installed on it. I have a windows 2000 Database server that is just a member server of hte domain. My NT4 machine is running out of space, so I am getting a new server for exchange. I will install Windows 2000 on this server and then follow the Ed Crowley Server Move method, to move my exchange server over to this new machine. I am comfortable with this. I have just now installed an NT4 BDC into the domain (it is only a very old machine so it ...

Biggest worldwide free Entertainment multi language Video web , Travel, Sports, Health , Racing cars , Massages techniques, Games , Fashions, Jokes , Top models , Free online IT learning , 5000 l
Hi , I'd like to introduce you 2 biggest free Video multi language entertainment websites : http://www.vietnam4all.net/ http://www.webcool24.com/ Best regards. ...

Archiving of Windows Live Mail
Can someone please point me to a procedure that will explain how to off load a bunch of emails that I want to keep but do not want in the active WLM folders. Seems like in the Outlook Express days there was a way but I have long since forgot what I did. Help appreciated. You could create a folder(s) on the Desktop and just drag messages into it. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "Ken" <krlorenz@comcast.net> wrote in message news:EB7EFBBB-12DA-4CAF-A02C-556B10A60C58@microsoft.com... > Can someone please poin...

Export News from Outlook express and import into windows mail
I only used outlook express for newsgroup so I need to backup and transfer all the messages that I flagged with the glasses icon. I just installed windows mail and it only downloaded the first 1000 messages. I can't see all of my messages because some of them they are old ... maybe 2002 but i need them all in the same place. How can I transfer these messages and the replies to windows mail? Outlook Express as well as other newsreaders only mirror what is on a news server and newsgroups neither import nor export. You can only export the account setting, but not groups or...

I'm wondering if this would be the proper application of XML, XSD and a datagrid
Hi I'm James Newbie I'm going to use some xml from a previous posters because it's similiar to mine <Store> <Name> My Book Store</Name> <Phone> 555-555-5555 </Phone> <Book id="1" > <Title>Thermodynamics Unleashed</Title> <Price>56.00</Price> </Book> <Book id="2" > <Title>CAD CAM</Title> <Price>72.00</Price> </Book> <Book id="3" > <Title>Machine Design</Title> <Price>56.00</Price> </Book> </Store> I was thin...

SOAP Server Application Faulted error 01-19-04
Hi, I get following error when creating a user in MS CRM 1.2 english: "SOAP Server Application Faulted error" with the Error Code 80005000 The CRM installation works fine. I used a Domain Admin Account for the MS CRM services. I assigned a license to the Admin user. When I try to add users from the AD using the User Manager in the Deployment Manager, I receive this error. It is also not possible to add users using the CRM interface. Can anybody help? Hi Ralf, can you give us the details of the SOAPException? This will likely tell you what's wrong. Mike "Ralf M"...

run ShellExecute but from a console application
I Need to run ShellExecute but from a console application. Problem is that it expects to a window handle in the first parameter (other function like "system" is not appropriate). Can someone advise please? Thanks in advance Sam NULL handle is allowed. "Sam" <sam@rentai.com> wrote in message news:uFHRnQMeFHA.2180@TK2MSFTNGP12.phx.gbl... >I Need to run ShellExecute but from a console application. Problem is that > it expects to a window handle in the first parameter (other function like > "system" is not appropriate). > > Can someone adv...

Windows XP
I have a windows xp sp3 machine where there free space goes down to a fixed amount after a reset. Let me explain: I boot the machine (a 40GB HD divided in a 36GB and a 4GB partition), The 4GB partition shows only 600MB free, I run CHKDSK /F D: and it fixes the free space to 2 GB, I reset and it goes back to 600. The same situation is for the 36GB partition where it shows 4GB free but if I boot to the Recovery Console and run chkdsk c: /p it fixes the free space to 18GB but as soon as I reset the free space goes back to 4GB, so the same thing happens if chkdsk runs at boot. Win...

How to reduce thickness/width of window borders two "normal" 2 pixels?
On a certain WinXP all borders of all windows are very, very thick/width. Have a look at the following snapshot: http://img15.imageshack.us/img15/9364/capture20091215121445.png What is the reason resp. how can I reduce it to the "normal" size of (approx. 2 pixels) ? Camille Camille Petersen wrote: > On a certain WinXP all borders of all windows are very, very thick/width. > > Have a look at the following snapshot: > > http://img15.imageshack.us/img15/9364/capture20091215121445.png > > What is the reason resp. how can I reduce it to the &...

How do I restore the cell content window on my toobar?
tools options view ........formula bar -- Greetings from New Zealand Bill K "hutchc" <hutchc@discussions.microsoft.com> wrote in message news:4A53F690-97D4-43D6-A458-6AA82B95F575@microsoft.com... > From the View menu, choose Formula Bar hutchc wrote: -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Launch folder windows in separate processe
The setting as in subject selected under Control Panel -> Folder Options More than one windows explorer open. Each of them opened in other folder. One of them opened for search function. However, if investigating with Task Manager all windows explorer windows lead to the same explorer process (task right click -> Go to process). The list "Processes" of task manager presents only one explorer window. So the setting as mentioned above not really functional. What's the reason? kakii wrote: > > The setting as in subject selected under Control Panel ...

Windows Malicious Software Removal Tool
Just a quick question, I am wondering if anyone else is having problems downloading Windows Malicious Software Removal Tool. I can download/install it from the Windows Update site but, it will not install using Automatic Updates. This is obviously not a serious problem but, I would like to solve it if possible. Rick Never such a problem here. Always state your full Windows version (e.g., WinXP SP3; WinXP 64-bit SP2; Vista SP1; Vista 64-bit SP2; Win7; Win7 64-bit) when posting in a forum or newsgroup. Please do so in your next reply. What anti-virus application or sec...

SendInput to a window belonging to another application thread
I'm trying to develop a simple application that can send input to a window belonging to another application thread, such as the microsoft on screen keyboard. The matter is that I don't understand how to know what was the last active window to which send the input from my dialog application. Looking on internet I've found a simple application called "Typematic" but it hide the application dialog before use the SendInput() api, it works well but I wish to obtain the same effect without hide the application dialog as the on screen keyboard does. How I could do it? Ho...

set excel always on top
Can I set excel to always be on top? I am using excel with a half screen and other programs and want excel to be on top as I switch between the other programs. TIA Todd L. that is a windows question. this is excel workgroup. >-----Original Message----- >Can I set excel to always be on top? I am using excel with a half screen and >other programs and want excel to be on top as I switch between the other >programs. > >TIA > >Todd L. >. > Take a look at this post: http://groups.google.com/groups?threadm=3D3DD50A.CF0CACC5%40msn.com Todd wrote: > &g...

Richedit in Asian Language Window
Hi all, I'm working on a application using richedit (V3.0) to display some text containing special character (i.e. ASCII > 128). It work fine in English Window, all those characters can display correctly. When I try to run the program in W2K(Traditional Chinese). All these character will "combine" with next character to form a double byte letter. For Example: "ABC?BDE" will display as "ABC?DE" in Chinese W2K Why the behavious of richedit is different in different OS? And How can I display the text correctly? Many Thx. Marco Marco Hung schrieb: > ...

How do I get email in Outlook Express on an XP machine into Outlook 2007 on Windows 7 Machine?
The instructions for importing Outlook Express files from another machine assume that Outlook Express can be run on the target machine. I don't believe there is a way to do that on a Windows 2007 machine. So How do I accomplish this? On Fri, 20 Nov 2009 18:03:05 -0800, MikeH <mikeh@somewhere.net> wrote: > The instructions for importing Outlook Express files from another > machine assume that Outlook Express can be run on the target machine. I > don't believe there is a way to do that on a Windows 2007 machine. So > How do I accomplish this? F...

SBS 2008 Reboot
I have a client who needed to reboot their server this AM (we couldn't log onto RWW, when this happens, they reboot. It happens once every couple of months.) Upon rebooting, they called and are telling me they are getting a windows titled "Windows Complete PC Restore". Why would this come up on a normal reboot? Did they have a failure of some sort? Can we get by this screen to get the server back online? I thought I would try here first, as I cannot get to the site until later this afternoon. Thank you in advance. -- Ron Anthony Quinn Is the SBS2008 DVD ...

Open IE seperate process and seperate window
Ok, here is a good puzzle. I need to automate opening two IE (independent windows) on two monitors. Here is the reason: I have a security guard that has to monitor two 16 channel DVR windows 24/7 and if the power fails, and / or the system is rebooted, needs to open and logon automatically without keyboard interaction. (keyboard / mouse has been removed). Here is the setup: I have two Security Camera systems (DVR) that have web interfaces. I have a computer setup with dual monitors I have the system to auto logon. I can manually open new IE sessions in seperate windows, then...

Windows Mail can't receive attachment from Outlook 2003
My friend using Outlook 2003 send a email that content attachment to me ( using Windows Mail) and the others friend that (using Outlook 2007). I can received the email but the attachment is missing, but the others friend he can received this email and the attachment together. Any solutions for this issue? Please help. Ask your friend (and any other Outlook users) to only send messages to you in Plain Text format, especially if there's an attachment. Keen wrote: > My friend using Outlook 2003 send a email that content attachment to me ( > using Windows Mail) an...

security privileges window upon opening GP
Hello: A user in Micorosoft Dynamics GP 9.0 can get into GP but not before getting a nuisance error message saying that he does not have security privileges to open this window. He has all of the minimum secuirty access to the system and company series including the Progress window. I have run through all of the TKs but to no effect. What else could it be? Thanks! childofthe1980s I helped another user recently with this and the message was caused by a form in the HR product. Please see this thread for the troubleshooting steps we used. The posting was Security error when loggin...

Application-defined or Object-defined-error when changing color in
I have tried the following different approaches to chaning the background color of a cell in an Excell 2007 VBA module and have gotten Application-defined or Object-defined-error each time. I can display the color value I just can't seem to be able to change it. Sheet1.Cells(1, 2).Interior.Color = RGB(126, 255, 126) Worksheets("sheet1").Cells("A1").Interior.ColorIndex = 3 ActiveSheet.Cells(Cell).Interior.ColorIndex = 255 Range("A1").Cells.Interior.ColorIndex = 1 Any help is welcomed. Thank you in advance for your help. hi t...

Change "main" calendar
Is there anyway to tell outlook which calendar to consider the "main" calendar? Outlook 2007 Thanks "njem" <njem@q.com> wrote in message news:d53c96fd-b896-4647-b045-40f01fde5421@k2g2000pro.googlegroups.com... > Is there anyway to tell outlook which calendar to consider the "main" > calendar? > > Outlook 2007 Your default calendar (and ALL your other default folders are included as well) is _always_ the calendar in the data store marked as "default" on Tools?>Account Settings>Data Files. -- Brian Tillman...