No at the bottom of the screen
Ive created both 16x16 and 32x32 ico files
and ive tried including as content in the project and compile
assign it as a solutions icon absolutley nothing!!
Im using vis studio 2003 and vb dot net
Basically i want an image to be displayed on the system toolbar at the bottom.
Ive based my form load code on Mr Feinmans article (Thanks alex very useful)
But nothing comes up in the emulator!!
Pray tell me how are you expected to develop apps for the pocket PC when
trying to display an Icon appears to be a mamoth task!!!
An ideas please!!!
' Extract icon from the application's exe
' This requires that app icon were set in the project properties
Dim szPath As String =
Path.GetDirectoryName([Assembly].GetExecutingAssembly().GetModules(0).FullyQualifiedName)
Dim szAssemb =
[Assembly].GetExecutingAssembly().GetModules(0).FullyQualifiedName
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(Form1))
Me.Icon = CType(resources.GetObject("$this.Icon"),
System.Drawing.Icon)
Me.mainMenu1 = New System.Windows.Forms.MainMenu
Me.Menu = Me.mainMenu1
Me.Text = "Form1"
ExtractIconEx(szAssemb, 0, 0, hIcon, 1)
' Fill NOTIFYICONDATA with data
Dim nid As New NOTIFYICONDATA
' In our struct definition we have omitted emebedded wchar array
size 64 - we need to account for it
Dim cbSize As Integer = Marshal.SizeOf(nid) + 64 *
Marshal.SystemDefaultCharSize
' Allocate memory
Dim pData As IntPtr = LocalAlloc(LPTR, cbSize)
Dim ltemp As IntPtr
' Set fields of the NOTIFYICONDATA (see SDK documentation)
nid.cbSize = cbSize
nid.hIcon = hIcon
nid.hWnd = msgWnd.Hwnd
nid.uCallbackMessage = msg
nid.uID = 1
nid.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
Marshal.StructureToPtr(nid, pData, False)
' Add tooltip
Dim arrTooltip As Char() = "My tooltip".ToCharArray()
ltemp = LocalAlloc(LPTR, pData.ToInt32() + Marshal.SizeOf(nid))
Marshal.Copy(arrTooltip, 0, ltemp, arrTooltip.Length)
' Register with shell
Dim ret As Boolean = Shell_NotifyIcon(NIM_ADD, pData)
LocalFree(pData)
' Set up event handler to handle incoming messages
AddHandler msgWnd.AfterMessageEvent, AddressOf
msgwnd_AfterMessageEvent