C# Windows always on top

Hi All,

I have a question about how to make a windows always on top of other
windows except the messageBox.

If i use TopMost properties, when my main application pop up a
messsageBox, then it will be behide the top most windows and i cannot
click on the messageBox easily.

Does anyone know how to solve this problem?THanks

Best regards,
FAI
0
linuxfedora
11/30/2009 9:55:30 AM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

3 Replies
1858 Views

Similar Articles

[PageSpeed] 18

linuxfedora <linuxfedora@yahoo.com.hk> wrote in news:a29c2c62-c905-4799-
84a1-6113c7f4e395@u8g2000prd.googlegroups.com:

> I have a question about how to make a windows always on top of other
> windows except the messageBox.
> 
> If i use TopMost properties, when my main application pop up a
> messsageBox, then it will be behide the top most windows and i cannot
> click on the messageBox easily.
> 
> Does anyone know how to solve this problem?THanks

You mean you want the window to always be on top of all other programs, 
not just topmost in the program?

I would look at calling Win32 library function SetForeGroundWindow. Note 
that this can get very annoying. If this is an errant user, I would 
consider training prior to making the application always go to the top. 
I, personally, get annoyed when something forces me to use it or kill 
it, as it is taking up prime real estate on my screen. 

Peace and Grace,

-- 
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
|      Think outside the box!             |
*******************************************
0
Gregory
11/30/2009 3:46:44 PM
Well, you could disable topmost for the duration of the MessageBox

        private void ShowMessage(string message)
        {
            TopMost = false;
            Application.DoEvents();
            MessageBox.Show(message);
            TopMost = true;
        }

-- 
Happy Coding!
Morten Wennevik [C# MVP]


"linuxfedora" wrote:

> Hi All,
> 
> I have a question about how to make a windows always on top of other
> windows except the messageBox.
> 
> If i use TopMost properties, when my main application pop up a
> messsageBox, then it will be behide the top most windows and i cannot
> click on the messageBox easily.
> 
> Does anyone know how to solve this problem?THanks
> 
> Best regards,
> FAI
> .
> 
0
Utf
11/30/2009 4:06:01 PM
Thanks, it works.

On 12=E6=9C=881=E6=97=A5, =E4=B8=8A=E5=8D=8812=E6=99=8206=E5=88=86, Morten =
Wennevik [C# MVP]
<MortenWenne...@hotmail.com> wrote:
> Well, you could disable topmost for the duration of the MessageBox
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 private void ShowMessage(string message)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TopMost =3D false;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Application.DoEvents();
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MessageBox.Show(message);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TopMost =3D true;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
>
> --
> Happy Coding!
> Morten Wennevik [C# MVP]
>
> "linuxfedora" wrote:
> > Hi All,
>
> > I have a question about how to make a windows always on top of other
> > windows except the messageBox.
>
> > If i use TopMost properties, when my main application pop up a
> > messsageBox, then it will be behide the top most windows and i cannot
> > click on the messageBox easily.
>
> > Does anyone know how to solve this problem?THanks
>
> > Best regards,
> > FAI
> > .
>
>

0
linuxfedora
12/2/2009 1:25:15 AM
Reply:

Similar Artilces:

how do I lock my p.c. when Im not around
Im using Micros. office 2003 and I need to know how to stop people from looking at my info. Depends a little upon your operating system but press CTRL+ALT+DELETE and it should offer you the option to lock the computer. To unlock it you'll simply type your password. -- -Ben- Ben M. Schorr, MVP Roland Schorr & Tower http://www.rolandschorr.com http://www.officeforlawyers.com Author - The Lawyer's Guide to Microsoft Outlook 2007: http://tinyurl.com/5m3f5q "shanecb" <shanecb@discussions.microsoft.com> wrote in message news:7454B12E-6A54-4AB4-9F15-CA60F35FEE48@...

Learning C# properties from O'Relly book
In a simple time class, int hour /* public int Hour // This works { get { return hour; } set { hour = value; } } */ // Automatic property? public int Hour { get; set; } // This doesn't set hour ! // Client code Time t = new Time(now); int theHour = t.Hour; Console.WriteLine("\nRetrieved the hour: {0}\n", theHour); theHour++; Console.WriteLine("\nUpdated the hour: {0}\n", theHour); Michael Hanson wrote: > [...] > // Automatic property? > public int Hour { get; set; } // This doesn't set hour ! W...

Dialog box stays on top of form
On a form called "Menu" one of the selections is Rolodex Menu. When the user selects Rolodex Menu it opens a dialog box. The user than selects one of four options on the Rolodex Menu like "search" and another dialog box opens to allow the user to enter "criteria" while the "search" dialog box closes. Everything to this point works fine. The "criteria" dialog box opens the "rolodex form" , the "criteria" dialog closes and the "search" dialog box reappears on top of all the forms. How do I get the "s...

Outlook 2003 Smart Tag Integration with MSN Messenger 7.0 vs Windows Messenger
Is there a way to use MSN Messenger 7.0 with the Outlook 2003 Smart Tag integration instead of useing Windows Messenger? Seems really silly that Outlook 2003 would use Windows Messenger a older product with less features then use MSN Messenger which is a newer product with more features. I've search all over the net for this answer and all I find is others asking the same questions but never and answer. -- Regards, Chris ...

export email a/c settings
Using Outlook XP there does not seem to be the facility to import/export email accout settings which I was able to do in Outlook 98. Is this correct or am I overlooking something? If this is correct how can I move the email a/c settings over to the new pc Any advice or suggestions would be appreciated tia Tom Tom <Tom@NoSpam.com> wrote: > Using Outlook XP there does not seem to be the facility to > import/export email accout settings which I was able to do in Outlook > 98. > Is this correct or am I overlooking something? Outlook 98 running in Internet Mail Only mod...

Windows Resizing
Hello, I have a DLL app that contains a dialog and inside a dialog there is a CWebBrowser2 control. I am trying to make CWebBrowser2 get maximized together with the Dialog so when a user maximizes dialog CWebBroswer2's width and height are changed with Dialog's width and height. Does anybody know how to make it work? Thank you, Victor. Catch the WM_SIZE message in your dialog (This message gets called when the user is changing the size of the dialog box) and change the size of the control accordingly. AliR. "victorsk" <victorsk@discussions.microsoft.com> wrot...

Exchange 2000/Windows 2000 resource forests?
Group, what needs to be done in each forest (where each forest=one domain) to enable users to be located in one forest and the Exchange server to be located in the other forest and to still have all the Exchange 2000 functionality? Regards /Peter I am afraid that is not posible on Windows 2000, because it does not support Forest relationships. Windows 2003 does support it. (i guess you are using windows 2000) >-----Original Message----- >Group, > >what needs to be done in each forest (where each forest=one domain) to >enable users to be located in one forest and the Exch...

windows explorer error message
Although my internet is working just fine, I keep receiving a message saying "windows explorer has stopped working, windows is checking for a solution to the problem" followed by a messaging saying "windows explorer is restarting" [which it doesn't restart at all.] Any program like "control panel" or windows media player doesn't work and will shut down after the message disappears. If I click cancel, then the message just pops up again. I don't know what to do, because i can't even get onto control panel to do a system restore to fix the pr...

Using GDI+ from MFC C++ ???
All of the links that I have found say they are showing you how to use GDI+ from C++, by they actually show you how to use GDI+ from C, not C++. For example they show you how to modify the WinMain() function. There is no WinMain() function in my MFC code. I want to be able to load and save PNG files and BMP files. Since Windows now does this, I would prefer to use Windows instead of any third party library. >All of the links that I have found say they are showing you >how to use GDI+ from C++, by they actually show you how to >use GDI+ from C, not C++. For e...

multiple windows creation without
Hi, Does anybody know how to create multiple windows without having a Winproc for each of them? My coworker and me are thinking of creating a debugwindow class(to display various algorithm related waveform/images), so that the user can create one or a few of such objects to show some intermidate results at their own choice. I knew normally every window has a winproc defined. Is it possible to create multiple windows without writing each one a winproc? Which will be the my way to solve my problems? >Does anybody know how to create multiple windows without having a Winproc >for...

windows messinger
can not sign into messinger. keep getting error code 8e5e03fe -- Gary In news:A5FAF95C-5DE6-42DD-A891-8EA9623C7255@microsoft.com, yrag <yrag@discussions.microsoft.com> typed: > can not sign into messinger. keep getting error code 8e5e03fe http://lmgtfy.com/?q=windows+messenger+error+codes ...

Installing an "Startup on Login" App on Vista or Windows 7?
To install a .NET app on XP so that it launches when the user logs in, all you had to do was add a folder named Startup to the User's Programs Menu object the Setup project's file system, and create a shortcut in that folder that runs the app's primary output. This does not seem to work with Vista or Windows 7, apparently due to the different location on the disk for the Start menu folder tree. What's the trick to get this to work on either XP, Vista or Windows 7? ...

Prompt for profiles not always offerred
I'm using Outlook 2000 and running Windows XP Pro. I have 3 profiles setup in Outlook. When I first start Outlook, it gives me the option to select a profile to use (which is normal). If I stay in that profile for a long time, when I exit and re-enter Outlook, I am not offerred the chance to select a new profile. I end up logging off and re-opening Windows XP and Outlook to regain the ability to select a profile. If I do not stay in the originally selected profile for a long time and exit Outlook, when I re-enter Outlook I can select a profile. So it appears that I loose the ...

saving excel as webpage so that hyperlinks load into different window #2
doesn't work, target="_new" isn't an html ta -- rsa ----------------------------------------------------------------------- rsai's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1542 View this thread: http://www.excelforum.com/showthread.php?threadid=27031 ...

Error while opening GP windows from BP
Hi all . I am getting an issue when we click 'Create Journal entries' item in the Financial Back Office Tasks webpart in Business Port4.0. "null-CWTSSession.openCannes:'oWTS' is null or not an object" I done a Terminal Server Setups as per the BP installation Document. Version Details : GP10.0,BP4.0,MOSS 2007 Note : I am getting this even for Administrator Login Regards Sunny Hi Sunny, A simple troublshooting steps: 1. Ensure that you can remotely access the server (where BP is installed) via Remote Desktop Connection (RDP). This will ...

Excel files get renamed when saved to windows 2003 server
when migrating to windows server 2003 some users experience changes of file names they change to all numbers and letters When you save a file, excel will save it as a temporary file (8 characters, no extension). Then if that save is successful, excel will delete the original and rename this funny named file to the original's name. You see the results when something interferes with this process. A couple of things that get pointed at are antivirus software and network problems (hardware or permissions). Since you just migrated, I'd start looking at the network side. But if that ...

How can I retrieve rows from 11 to 20 ( Selete TOP 10 gives first 10)
Using 'Select Top 10' gives me first 10 rows of my table. I need to retrieve the next 10 records. I am writing to an excel spreadsheet where I need to write top 10 rows starting from B2 and next 10 records starting from I2. So how can I split them? Every time I have to split into 10rows each. Thanks -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201004/1 Something like this will get the job done. I don't know your table/ field names... SELECT TOP 10 primaryKey FROM myTable WHERE primaryKey NOT IN (SELECT TOP...

FWD: See the security pack for Windows
--eudgiagthzn Content-Type: multipart/related; boundary="yldletmesehxxrm"; type="multipart/alternative" --yldletmesehxxrm Content-Type: multipart/alternative; boundary="osbkrvsbtnxtzcje" --osbkrvsbtnxtzcje Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Customer this is the latest version of security update, the "October 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three new vulnerabilities. Install now to p...

Set Up Windows Internet Explorer 8
I received a pop up stating to install Windows Internet Explorer 8 and I installed it. Now my computer is not cooperating as it did prior to the install on several previously used applications. Can you tell me how to fix it or uninstall. I want to make sure this was legitimate. Thank you No-charge support for Internet Explorer 8 installation, set-up and usage (only) is available via telephone (based on your locale) through 31 December 2009. Customers must be running Windows XP or Windows Vista in a non-domain environment. => US & CA Residents: 1-866-234-6020 =&g...

How to prevent popup the authencation login window when running re
We use CRM 3.0 + SQL Server 2005's reporting service. The reporting service is on the other site.The site had been configured windows integration authencation. The client PC access CRM site via IE and the client PC hasn't logged in sepcified windows domain. When I access CRM site from client, it prompts an system login window. I input the domain user and password,then enter the CRM system. When I click the report on CRM, the system login window appears again. Can anyone give me a solution to realize log in only once? Hi Joseph, I don't think it's possible. > The repo...

Owner draw main windows, will left some drawing on the background of the window, I want the reason and how to prevent this happen? 12-23-09
Hello, every one! Ownerdraw main window , I used SetWindowRgn to cut down the four corners, but there will left something drawing here when you drag the corners and borders to resized the window on the background of the main window. Only 3 corners of the four corners do this. Thanks a lot! begin 666 problem.JPG M_]C_X `02D9)1@`!`0$`8 !@``#_VP!#``@&!@<&!0@'!P<)"0@*#!0-# L+ M#!D2$P\4'1H?'AT:'!P@)"XG("(L(QP<*#<I+# Q-#0T'R<Y/3@R/"XS-#+_ MVP!#`0D)"0P+#!@-#1@R(1PA,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R M,C(R,C(R...

Windows had to close message when I close Word
I recently had to have my hard drive reformatted due to a virus. I am running Windows XP Home Edition and ever since I reinstalled Office 2007 every time I close Word I get a message that says "Microsoft Office Word has encountered a problem and needs to close. We are sorry for the inconvenience." Every once in a while when I try to save something it will start running the setup as well. Can anyone tell me how to fix this? It gets downright irritating having to tell Office Word constantly not to save and try to recover my work since I already saved it and I...

need to download office 2003 to my windows xp
i have tried everything i know to find the office 2003 that my school says i need to continue with my corses. however, all i find is the updates for office 2003 . i dont need the updates untill i get the original , do i ? -- dianne You cannot use the updates without the original. And Office is not downloadable. You need to purchase a copy. As a student there are some great deals available to you. Try your school bookstore. And BTW..this is a Dynamics GP (Great Plains) site. -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for Software Users Get our Free Tip...

Drop down windows
I'm BRAND-NEW, and wanting to design something that has drop down windows, and I want to have my values in these windows. I want to be able to pick from the values, and basicly weed out the other choices in this way. Is this possible? I am getting more fluent with excel, is it possible to do in Excel? Can you help? PLEASE!!? Hi see your other post -- Regards Frank Kabel Frankfurt, Germany "Rightmer" <rightmer@hotmail.com> schrieb im Newsbeitrag news:64B88346-86D7-4DA1-A612-0465241A621A@microsoft.com... > I'm BRAND-NEW, and wanting to design something that has dro...

calling/loading c++ dll
I made a dll in c++ to do some calculations, and i call it from vba ( for excel XP, also tried it fro access and excel 2000) Problem is that when i copy the dll to another PC and run the same vba code i get "run time error 53, dll file not found", on the pc where the dll i created everything works nice I've tried to register the dll with regsvr32 and from the vba code, with "regsvr32 myDll.dll" i get the error "the specified module could not be found" I used a "MFC DLL " project in visual studio .net to create the dll, in basic i followed this exa...