Advertisement
Guest User

windows xp

a guest
May 21st, 2010
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. //it might even run
  2. static void Main(string[] args)
  3.         {
  4.             Int32 lhWndParent = User32.FindWindow(null, "Minesweeper");
  5.             Int32 hMenu = User32.GetMenu(lhWndParent);
  6.             Int32 hViewMenu = User32.GetSubMenu(hMenu, 1);
  7.             Int32 hHelp = User32.GetMenuItemID(hViewMenu, 2);
  8.             User32.SendMessage((IntPtr)lhWndParent, User32.WM_COMMAND, hHelp, null);
  9.         }
  10.  
  11. class User32
  12.     {
  13.         [DllImport("user32", EntryPoint = "FindWindowA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
  14.         public static extern Int32 FindWindow(string lpClassName, string lpWindowName);
  15.         [DllImport("user32", EntryPoint = "GetMenu", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
  16.         public static extern Int32 GetMenu(Int32 hwnd);
  17.         [DllImport("user32", EntryPoint = "GetSubMenu", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
  18.         public static extern Int32 GetSubMenu(Int32 hMenu, Int32 nPos);
  19.         [DllImport("user32", EntryPoint = "GetMenuItemID", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
  20.         public static extern Int32 GetMenuItemID(Int32 hMenu, Int32 nPos);
  21.         [DllImport("user32")]
  22.         public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, String lParam);
  23.  
  24.         public const int WM_COMMAND = 273;
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement