James
Thu Mar 06 14:47:45 CST 2008
Thanks again Christopher, I have taken a look at your sources and have used
the MSDN link below. I downloaded Alex's NotifyIcon.cs class and made the
Image change.
Added reference to the newly compiled dll and Imported it.
Created a Noty object based on the NotifyIcon class (withevents).
Added a form Load and Closing events where I run Noty.add and Noty.remove.
The system tray shows my icon, just as I had seen it prior. The only problem
is that it disappears after the first use? After checking everything I
realized my Icon object was went out of scope and resulted in a null icon -
Added an global Icon object from my .ico file and problem solved!
Thanks for the link!
-James
system tray icon
notifyicon
Shell_NotifyIcon
"Christopher Fairbairn" <christopher@christec.co.nz> wrote in message
news:uC5qIX3fIHA.748@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> "James" <james_devitt@hotmail.comi> wrote in message
> news:0BCD1F58-A799-4A07-80D1-7FE720772E68@microsoft.com...
>> In desktop apps I used the NotifyIcon control. I have read that is
>> control is not support in the CF. How was that Icon displayed?
>
> You are correct. The functionality is present within the native OS in the
> form of the Shell_NotifyIcon API, but the .NET Compact Framework does not
> provide a wrapper around it.
>
> This means you have to use Platform Invoke functionality to access the
> native API, essentially creating your own class that parallels the
> NotifyIcon class from the desktop framework.
>
> There are a couple of examples available which demonstrate doing this
> (although many can be simplified a little now, since they were originally
> written for .NET CF 1.0).
>
> See for example Alex Yakhnin's "Using the Microsoft .NET Compact Framework
> MessageWindow class" article available on MSDN at
>
http://msdn2.microsoft.com/en-us/library/aa446525.aspx.
>
> Hope this helps,
> Christopher Fairbairn
>