February 2005 - Posts

ControlInfoView : View the location and size of the selected control in the status bar Visual Studio 2003 .net

ControlInfoView

ControlInfoView is a free add-in for Visual Studio .NET 2002 and 2003. When in Windows Forms Designer, it simply shows the location and size of the selected control in the status bar.

http://www.tbssoftware.com/products.php

 

Modify a Window's System Menu (vb.net) Help!

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...
      }
    }
  }