/// <summary> /// Create the contexual menu for the sys tray /// </summary> /// <param name="e">event args</param> protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); var hSysMenu = User32Interop.GetSystemMenu(this.Handle, false); User32Interop.AppendMenu(hSysMenu, MF_SEPARATOR, 0, string.Empty); User32Interop.AppendMenu(hSysMenu, MF_STRING, SYSMENU_EXITID, "E&xit…"); }