Is there any way to add tray icon of an application that is executed in background I wrote an application in C# and i want when it is sent to background(it is minimized) to get an icon in the tray. When i click the tray icon, i get the application back again...
I work in C#, in Visual Studio 2005. The whole project is about PPC Windows Mobile 5 device.
Thank you

Tray Icon in C# in WM5
AlexBB
Dear Perarg,
I have done some search on this topic.
There is no managed class that can be used to add a try icon for an application in .NET CF. But we still can implement it with P/Invoke native code. (NOTIFICATIONDATA structure, and etc).
Here is the link. Click.
The topic of this resource is on advanced P/Invoke technology, and fortunately, it use an example that implements the Tray Icon. That is what we want.
Regards,
Zero Dai - MSFT
Mike Lee Han Ming
Dear Perarg,
I write a sample code for you. Hope that can give you some ideas.
I just use Notification control in .net CF v2.0. See:
1. Initialize the notification control as follow:
notification1.Text =
"demo"; FileStream IconStream = new FileStream(".\\My Documents\\setup.ico", FileMode.Open, FileAccess.Read);notification1.Icon =
new Icon(IconStream, 16, 16);notification1.Caption =
"Notification Demo";notification1.Critical =
false;notification1.InitialDuration = 0;
notification1.Visible =
false;2. Setup a global variable to indicate if the form is minimized
Boolean
isMinimized = false;3. In the Deactivate event handler of Form
if
(isMinimized == false){
notification1.Visible =
true;isMinimized =
true;}
4. In the BalloonChanged event handler of notificationif
(isMinimized == true){
if (e.Visible == true){
isMinimized =
false; this.notification1.Visible = false; this.Show();}
}
Regards,Zero Dai - MSFT
Sundaar
Hi Perarg
The Windows Mobile 5.0 Pocket PC SDK ships with a C++ sample showing how to add a tray icon:
...\windows ce tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Trayapp
This article may help to convert this sample into C# code.
Michael
foleyp
Have you seen this article:
http://msdn2.microsoft.com/en-us/library/aa446525.aspx
gmcbay
venp
THANKS! (for your time!)...But...
I had reached at this point... And i couldnot find a way to disappear the "Notification" command in the left down corner...(picture 1). That was the reason why i was searching something for the tray bar...(look down)
My first question was about the tray bar(is this called like this or was i wrong ). I want to place a notification icon down to the tray bar like picture 2...
james_m
The msdn C# notifyicon sample download does not work with VS2005 CF 2 WM 5. Works fine on 2003 devices CF 1.1.
Any alternatives to the opennet dll
TIA
HighTower
Dear Perarg,
I found a very useful sample code.
This will help you more!!
Take it. Click.
Regards,
Zero Dai - MSFT
Barbie G