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;
- }
- }
- }
- private void InitializeComponent()
- {
- this.webBrowser1 = new System.Windows.Forms.WebBrowser();
- this.SuspendLayout();
- //
- // webBrowser1
- //
- this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.webBrowser1.Location = new System.Drawing.Point(0, 0);
- this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
- this.webBrowser1.Name = "webBrowser1";
- this.webBrowser1.Size = new System.Drawing.Size(453, 304);
- this.webBrowser1.TabIndex = 0;
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(453, 304);
- this.Controls.Add(this.webBrowser1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
- this.Name = "Form1";
- this.ShowIcon = false;
- this.ShowInTaskbar = false;
- this.Text = "iGadgetEX TX XT Pro";
- this.Deactivate += new System.EventHandler(this.Form1_Deactivate);
- this.Activated += new System.EventHandler(this.Form1_Activated);
- this.ResumeLayout(false);
- }
Add Comment
Please, Sign In to add comment