Hello,

I'm trying to add a "Send to Notification Area" item to the context menu for
my application's taskbar button. (For example, right-click a CHM file
(i.e., SQL Server BOL) in the taskbar, and it has three extra menu
items...Separater, Jump to URL, and Version.)

The only thing I found that might be what I'm looking for is in C#
(below)...having a hard time translating. How do I do this in VB.NET?

Thank you!

http://tinyurl.com/44ulh

' <snip>

[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);

[DllImport("user32.dll")]
private static extern bool AppendMenu (IntPtr hMenu, Int32 wFlags, Int32
wIDNewItem, string lpNewItem);

public const Int32 WM_SYSCOMMAND = 0x112;
public const Int32 MF_SEPARATOR = 0x800;
public const Int32 MF_STRING = 0x0;
public const Int32 IDM_ABOUT = 1000;

private void Form1_Load(object sender, System.EventArgs e)
{
IntPtr sysMenuHandle = GetSystemMenu(this.Handle, false);
AppendMenu(sysMenuHandle, MF_SEPARATOR, 0, string.Empty);
AppendMenu(sysMenuHandle, MF_STRING, IDM_ABOUT, "About...");
}

protected override void WndProc(ref Message m)
{
if(m.Msg == WM_SYSCOMMAND)
switch(m.WParam.ToInt32())
{
case IDM_ABOUT :
MessageBox.Show("This is About dialog");
return;
default:
break;
} base.WndProc(ref m);
}

' </snip>

Re: Customize TaskBar Menu by Mick

Mick
Wed Sep 29 15:36:34 CDT 2004

That'll be the Window Menu. This is done via InterOp and you will find a VB
and a C# implementation on my site.
http://dotnetrix.co.uk/menus.html

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


<anon> wrote in message news:uqKk6LmpEHA.1988@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I'm trying to add a "Send to Notification Area" item to the context menu
> for
> my application's taskbar button. (For example, right-click a CHM file
> (i.e., SQL Server BOL) in the taskbar, and it has three extra menu
> items...Separater, Jump to URL, and Version.)
>
> The only thing I found that might be what I'm looking for is in C#
> (below)...having a hard time translating. How do I do this in VB.NET?
>
> Thank you!
>
> http://tinyurl.com/44ulh
>
> ' <snip>
>
> [DllImport("user32.dll")]
> private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
>
> [DllImport("user32.dll")]
> private static extern bool AppendMenu (IntPtr hMenu, Int32 wFlags, Int32
> wIDNewItem, string lpNewItem);
>
> public const Int32 WM_SYSCOMMAND = 0x112;
> public const Int32 MF_SEPARATOR = 0x800;
> public const Int32 MF_STRING = 0x0;
> public const Int32 IDM_ABOUT = 1000;
>
> private void Form1_Load(object sender, System.EventArgs e)
> {
> IntPtr sysMenuHandle = GetSystemMenu(this.Handle, false);
> AppendMenu(sysMenuHandle, MF_SEPARATOR, 0, string.Empty);
> AppendMenu(sysMenuHandle, MF_STRING, IDM_ABOUT, "About...");
> }
>
> protected override void WndProc(ref Message m)
> {
> if(m.Msg == WM_SYSCOMMAND)
> switch(m.WParam.ToInt32())
> {
> case IDM_ABOUT :
> MessageBox.Show("This is About dialog");
> return;
> default:
> break;
> } base.WndProc(ref m);
> }
>
> ' </snip>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004



Re: Customize TaskBar Menu by anon>

anon>
Wed Sep 29 15:48:14 CDT 2004

Perfect!! Thanks, Mick!

"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:%23OCxFQmpEHA.536@TK2MSFTNGP11.phx.gbl...
> That'll be the Window Menu. This is done via InterOp and you will find a
VB
> and a C# implementation on my site.
> http://dotnetrix.co.uk/menus.html
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>
>
> <anon> wrote in message news:uqKk6LmpEHA.1988@TK2MSFTNGP09.phx.gbl...
> > Hello,
> >
> > I'm trying to add a "Send to Notification Area" item to the context menu
> > for
> > my application's taskbar button. (For example, right-click a CHM file
> > (i.e., SQL Server BOL) in the taskbar, and it has three extra menu
> > items...Separater, Jump to URL, and Version.)
> >
> > The only thing I found that might be what I'm looking for is in C#
> > (below)...having a hard time translating. How do I do this in VB.NET?
> >
> > Thank you!
> >
> > http://tinyurl.com/44ulh
> >
> > ' <snip>
> >
> > [DllImport("user32.dll")]
> > private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
> >
> > [DllImport("user32.dll")]
> > private static extern bool AppendMenu (IntPtr hMenu, Int32 wFlags, Int32
> > wIDNewItem, string lpNewItem);
> >
> > public const Int32 WM_SYSCOMMAND = 0x112;
> > public const Int32 MF_SEPARATOR = 0x800;
> > public const Int32 MF_STRING = 0x0;
> > public const Int32 IDM_ABOUT = 1000;
> >
> > private void Form1_Load(object sender, System.EventArgs e)
> > {
> > IntPtr sysMenuHandle = GetSystemMenu(this.Handle, false);
> > AppendMenu(sysMenuHandle, MF_SEPARATOR, 0, string.Empty);
> > AppendMenu(sysMenuHandle, MF_STRING, IDM_ABOUT, "About...");
> > }
> >
> > protected override void WndProc(ref Message m)
> > {
> > if(m.Msg == WM_SYSCOMMAND)
> > switch(m.WParam.ToInt32())
> > {
> > case IDM_ABOUT :
> > MessageBox.Show("This is About dialog");
> > return;
> > default:
> > break;
> > } base.WndProc(ref m);
> > }
> >
> > ' </snip>
> >
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
>
>