A discussion came up on the newsgroup regarding using a system tray icon from within .NETCF code and how the icons are handled. The way this is done (including in OpenNETCF's NotifyIcon control) is to use the icon of the calling assembly using the native LoadIcon function.
The tray icon needs to be a 16x16 icon, however to look right in the Programs screen the application needs a 32x32 icon too. There is some confusion of how to handle multiple icons within a .NETCF application. Adding multiple icons through embedded resources does not make these icons accessible from native functions such as LoadIcon because .NETCF does not store these icons as Portable Executable (PE) resources, instead using the .NET method with manifests. Therefore in the normal build process the only PE icon to be built into the executable will be that which is specified in the ApplicationIcon property in the project properties:-
The icon file in this case was created using Visual Studios icon editor, this contains two icons: 32x32 256 color and 16x16 256 color. You can download the sample .ico here. To illustrate which is used they contain merely a number with their size (32 and 16 respectively).
In the Start Menu / Programs the 32 icon is used to display a correctly sized icon. When the NotifyIcon is created it automatically uses the 16x16 sized image.
One final note about the application icon is that .NETCF executables all store their application icon with the resource identifier 32512. so a native handle to the icon of the currently executing application can be got using
IntPtr hIcon = LoadIcon(GetModuleHandle(null), "#32512");
LoadIcon is within Coredll.dll and you'll find the P/Invoke details in the OpenNETCF Smart Device Framework source. When you have finished with the handle you should call DestroyIcon to free up resources used.
Sample Icon