I was trying to add a “About“ in a vb.net application's System (or Control) Menu as they say (ya know the one with the minimize,maximize,close etc) , I had done this in VB6 before, but its strange I can get it done in vb.net, I know the technique is to get the handle and add a separtor and then our new menu etc...
Found this code at http://www.developerfusion.com/show/4655/ but was in c#, can somehelp dissecting it to work in vb.net or provide an alternative ?
Thanks.
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
private static extern int GetSystemMenu (int hwnd, int bRevert);
[DllImport("user32.dll")]
private static extern int AppendMenu (
int hMenu,int Flagsw,int IDNewItem,string lpNewItem);
private void SetupSystemMenu ()
{
// get handle to system menu
int menu = GetSystemMenu(this.Handle.ToInt32(),0);
// add a separator
AppendMenu(menu,0xA00,0,null);
// add an item with a unique ID
AppendMenu(menu,0,1234,"About SiteWatcher");
}
protected override void WndProc (ref Message m)
{
base.WndProc(ref m);
// WM_SYSCOMMAND is 0x112
if (m.Msg == 0x112)
{
// check for my new menu item ID
if (m.WParam.ToInt32() == 1234)
{
// show About box here...
}
}
}