473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Customize TaskBar Menu

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>
Nov 21 '05 #1
2 4245
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:uq**************@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
Nov 21 '05 #2
Perfect!! Thanks, Mick!

"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:%2***************@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:uq**************@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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: deko | last post by:
I've found that the "Remove Filter/Sort" selection in the Shortcut menu (displayed on right click) produces ugly, untrappable errors, even though "Allow Filters" is set to No in the subform. ...
2
by: JMCN | last post by:
hi i'm having a problem with the customize a shortcut menu. i read the ms office assistance: customize a shortcut menu/delete a command or add to a shortcut menu and followed the simple...
3
by: Maka Sili | last post by:
Hi, My VC++ application does not have a titlebar (and therefore no System menu, no minimize, no maximize and no close button). We have a custom button for minimize and close. When the app...
0
by: Oney | last post by:
Can I catch windows taskbar mouse events with Javascript( on the taskbar right click mouse and click close on the menu) When browser is open, on the taskbar mouse right click, click window...
0
by: Salem | last post by:
Hello everyone! :) In case anyone wanted to replace the winxp system menu that pops up every time you right click your apps taskbar button with your own context menu read on... I googled a...
3
by: Jimmy | last post by:
I'm kinda newbie to python and wxPython. Now I'm confronting a thorny problem: how can I make my program minimize to the taskbar represented as an ico, and when there is some message from network...
0
by: bz | last post by:
Hi, I need an app to run in kiosk mode, so user will not have access to start menu and taskbar while the app is running I was able to hide / show the taskbar with trhe following code when app...
0
by: Sky | last post by:
I have an Access 2003 front-end database with custom toolbars. The toolbars work fine. One annoying feature is that at the far right edge of each custom toolbar there a small dropdown arrow....
0
by: aaronyoung | last post by:
Is there a way, in Access, to create a custom menu bar that can be used as the default menu bar that will, in essence, function like the Window's Taskbar? I would like the menu bar to show all...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.