Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

restoring window minimzed to the system tray?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Smith - 19 Jan 2005 01:18 GMT
I have an app that minimizes itself to the system tray.  It's also
single instance; when a second instance is started, it just activates
the first one and quits.

When the first instance isn't in the system tray, I can use
ShowWindowAsync() via interop to bring it to the front.  When it's
minimzed to the system tray, nothing seems to restore it back to a
window.  I've tried all the obvious variations of SW_SHOW, SW_RESTORE,
etc.  Has anyone gotten this to work?
MailInterface - 20 Jan 2005 13:51 GMT
try this out

using System.Runtime.InteropServices;

#region Check for existing Instance
// get the name of our process
string proc=Process.GetCurrentProcess().ProcessName;
// get the list of all processes by that name
Process[] processes=Process.GetProcessesByName(proc);
// if there is more than one process...
if (processes.Length > 1)
{
MessageBox.Show("Already One Instance of this Application is
running.\nPlease check in the system Tray.\nThis Instance will Exit
now.");
// exit our process
Application.ExitThread();
                   
                }
                #endregion

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.