![]() |
|
#1
|
|||
|
|||
How to minimize window in to system tray using WIN32Hi,
I want help regarding, how to minimize window to system tray using Win32. Anyone please help me with some sample code. |
|||
|
#2
|
||||
|
||||
Re: How to minimize window in to system tray using WIN32Firstly you need the CFrameWnd* pointer to the frame (window) of your application. If you want to minimize it from a DialogBox, pass the pointer to the DialogBox's class while initializing it.
Once you've got the pointer, all you have to do is call the ShowWindow(SW_SHOWMINIMIZED). Therefore if you want to minimize from the frame itself, use: this->ShowWindow(SW_SHOWMINIMIZED); else use the pointer assigned to it. If you want to minimize ANY window (assuming you have the handle) use: ShowWindow(HWND hWnd, int ShowCmd) __________________
[b]There are times when the Phantom walks the streets as an ordinary man...this is one of those times. |
|
#3
|
|||
|
|||
Re: How to minimize window in to system tray using WIN32Follow the steps below:
Step 1: Define a user message that will be used to handle the events happening on your app's system tray icon. For example: CPP / C++ / C Code:
Step 2: When you want to show your app icon in the system tray, call the win API Shell_NotifyIcon() some way like this: CPP / C++ / C Code:
Explanation about Shell_NotifyIcon() and NOTIFYICONDATA structure can be found in MSDN. By now, your application's icon has appeared in the system tray. You may also change your window's style if necessary, ie. hiding the window. Step 3: The WM_MESSAGE handler looks somewhat like this: CPP / C++ / C Code:
Step4: When you want to delete your tray icon, call Shell_NotifyIcon() again with NIM_DELETE parameter: CPP / C++ / C Code:
That's it! I hope it will be of any help. |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Fltk app in system tray? | hcker2000 | FLTK Forum | 3 | 31-Jan-2006 02:29 |
| How to minimize a application to the system tray? | Thomas555 | C++ Forum | 12 | 20-May-2005 14:35 |
| Win32 Window Shading behavior (like linux) | WillyumYum | C++ Forum | 3 | 18-Apr-2005 15:36 |
| #including resource file causing window procedure to be undeclared??? | ubergeek | C++ Forum | 3 | 07-Feb-2005 15:39 |
| Changing window start colour | Rosdahale | C++ Forum | 5 | 19-Jan-2005 16:51 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The