Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace DesktopGadget
- {
- public partial class Form1 : Form
- {
- [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);
- public Form1()
- {
- InitializeComponent();
- SetupSystemMenu();
- }
- private void SetupSystemMenu()
- {
- // Handle des Menue's
- int menu = GetSystemMenu(this.Handle.ToInt32(), 0);
- // Separator einf�gen
- AppendMenu(menu, 0xA00, 0, null);
- // Eindeutige ID (IDNewItem) als Beispiel 111
- AppendMenu(menu, 0, 111, "Settings");
- }
- protected override void WndProc(ref Message m)
- {
- base.WndProc(ref m);
- if (m.Msg == 0x112)
- {
- // Wurde die ID 111 (unsere Testeintrag) angeklickt?
- if (m.WParam.ToInt32() == 111)
- {
- string sInput = Microsoft.VisualBasic.Interaction.InputBox("Enter URL", "Settings", "http:\\google.de", 0, 0);
- webBrowser1.Navigate(sInput);
- }
- }
- }
- private void Form1_Activated(object sender, EventArgs e)
- {
- this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
- }
- private void Form1_Deactivate(object sender, EventArgs e)
- {
- this.FormBorderStyle = FormBorderStyle.None;
- }
- }
- }
Add Comment
Please, Sign In to add comment