diff --git a/DuckDNS.v12.suo b/DuckDNS.v12.suo
index e1e28be..d04e916 100644
Binary files a/DuckDNS.v12.suo and b/DuckDNS.v12.suo differ
diff --git a/DuckDNS/DuckDNS.csproj b/DuckDNS/DuckDNS.csproj
index c6610fe..6c94af2 100644
--- a/DuckDNS/DuckDNS.csproj
+++ b/DuckDNS/DuckDNS.csproj
@@ -55,6 +55,8 @@
+
+
Form1.cs
diff --git a/DuckDNS/Form1.Designer.cs b/DuckDNS/Form1.Designer.cs
index e8d461b..4634f64 100644
--- a/DuckDNS/Form1.Designer.cs
+++ b/DuckDNS/Form1.Designer.cs
@@ -31,6 +31,10 @@ private void InitializeComponent()
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.updateNowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.btOk = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tbDomain = new System.Windows.Forms.TextBox();
@@ -41,11 +45,9 @@ private void InitializeComponent()
this.button1 = new System.Windows.Forms.Button();
this.lblInfo = new System.Windows.Forms.Label();
this.timer = new System.Windows.Forms.Timer(this.components);
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.updateNowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
- this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
+ this.installStartupShortcutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
@@ -57,6 +59,36 @@ private void InitializeComponent()
this.notifyIcon.Visible = true;
this.notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick);
//
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.updateNowToolStripMenuItem,
+ this.toolStripSeparator1,
+ this.installStartupShortcutToolStripMenuItem,
+ this.toolStripSeparator2,
+ this.exitToolStripMenuItem});
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(193, 104);
+ //
+ // updateNowToolStripMenuItem
+ //
+ this.updateNowToolStripMenuItem.Name = "updateNowToolStripMenuItem";
+ this.updateNowToolStripMenuItem.Size = new System.Drawing.Size(192, 22);
+ this.updateNowToolStripMenuItem.Text = "Update Now!";
+ this.updateNowToolStripMenuItem.Click += new System.EventHandler(this.updateNowToolStripMenuItem_Click);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(189, 6);
+ //
+ // exitToolStripMenuItem
+ //
+ this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
+ this.exitToolStripMenuItem.Size = new System.Drawing.Size(192, 22);
+ this.exitToolStripMenuItem.Text = "Exit";
+ this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
+ //
// btOk
//
this.btOk.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -165,33 +197,17 @@ private void InitializeComponent()
//
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
- // contextMenuStrip1
- //
- this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.updateNowToolStripMenuItem,
- this.toolStripSeparator1,
- this.exitToolStripMenuItem});
- this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(144, 54);
- //
- // updateNowToolStripMenuItem
+ // toolStripSeparator2
//
- this.updateNowToolStripMenuItem.Name = "updateNowToolStripMenuItem";
- this.updateNowToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
- this.updateNowToolStripMenuItem.Text = "Update Now!";
- this.updateNowToolStripMenuItem.Click += new System.EventHandler(this.updateNowToolStripMenuItem_Click);
+ this.toolStripSeparator2.Name = "toolStripSeparator2";
+ this.toolStripSeparator2.Size = new System.Drawing.Size(189, 6);
//
- // toolStripSeparator1
+ // installStartupShortcutToolStripMenuItem
//
- this.toolStripSeparator1.Name = "toolStripSeparator1";
- this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
- //
- // exitToolStripMenuItem
- //
- this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
- this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
- this.exitToolStripMenuItem.Text = "Exit";
- this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
+ this.installStartupShortcutToolStripMenuItem.Name = "installStartupShortcutToolStripMenuItem";
+ this.installStartupShortcutToolStripMenuItem.Size = new System.Drawing.Size(192, 22);
+ this.installStartupShortcutToolStripMenuItem.Text = "Install startup shortcut";
+ this.installStartupShortcutToolStripMenuItem.Click += new System.EventHandler(this.installStartupShortcutToolStripMenuItem_Click);
//
// Form1
//
@@ -239,6 +255,8 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem updateNowToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem installStartupShortcutToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
}
}
diff --git a/DuckDNS/Form1.cs b/DuckDNS/Form1.cs
index 2fa5999..785efbb 100644
--- a/DuckDNS/Form1.cs
+++ b/DuckDNS/Form1.cs
@@ -3,6 +3,8 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
+using System.Reflection;
using System.Text;
using System.Windows.Forms;
@@ -138,5 +140,11 @@ private void updateNowToolStripMenuItem_Click(object sender, EventArgs e)
{
UpdateDNS();
}
+
+ private void installStartupShortcutToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ string linkPath = Windows.GetStartupPath() + Path.DirectorySeparatorChar + "DuckDNS.lnk";
+ WShellLink.CreateLink(linkPath,"Duck DNS Updater",Assembly.GetExecutingAssembly().Location);
+ }
}
}
diff --git a/DuckDNS/Form1.resx b/DuckDNS/Form1.resx
index f5681b3..87d462f 100644
--- a/DuckDNS/Form1.resx
+++ b/DuckDNS/Form1.resx
@@ -154,9 +154,6 @@
123, 17
-
- 358, 17
-
AAABAAMAEBAAAAEAIABoBAAANgAAACAgAAABACAAqBAAAJ4EAAAwMAAAAQAgAKglAABGFQAAKAAAABAA
diff --git a/DuckDNS/ShellLink.cs b/DuckDNS/ShellLink.cs
new file mode 100644
index 0000000..0924cdb
--- /dev/null
+++ b/DuckDNS/ShellLink.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+
+namespace DuckDNS
+{
+ class WShellLink
+ {
+ public static void CreateLink(string name, string description, string path)
+ {
+ IShellLink link = (IShellLink)new ShellLink();
+
+ // setup shortcut information
+ link.SetDescription(description);
+ link.SetPath(path);
+
+ // save it
+ IPersistFile file = (IPersistFile)link;
+ file.Save(name, false);
+ }
+ }
+
+ [ComImport]
+ [Guid("00021401-0000-0000-C000-000000000046")]
+ class ShellLink
+ {
+ }
+
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("000214F9-0000-0000-C000-000000000046")]
+ interface IShellLink
+ {
+ void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, out IntPtr pfd, int fFlags);
+ void GetIDList(out IntPtr ppidl);
+ void SetIDList(IntPtr pidl);
+ void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName);
+ void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName);
+ void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath);
+ void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir);
+ void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath);
+ void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
+ void GetHotkey(out short pwHotkey);
+ void SetHotkey(short wHotkey);
+ void GetShowCmd(out int piShowCmd);
+ void SetShowCmd(int iShowCmd);
+ void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath, int cchIconPath, out int piIcon);
+ void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon);
+ void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved);
+ void Resolve(IntPtr hwnd, int fFlags);
+ void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile);
+ }
+}
diff --git a/DuckDNS/Windows.cs b/DuckDNS/Windows.cs
new file mode 100644
index 0000000..e60a4c2
--- /dev/null
+++ b/DuckDNS/Windows.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace DuckDNS
+{
+ class Windows
+ {
+ [DllImport("shell32.dll")]
+ static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner,
+ [Out] StringBuilder lpszPath, int nFolder, bool fCreate);
+ const int CSIDL_STARTUP = 0x7;
+
+ public static string GetStartupPath()
+ {
+ StringBuilder path = new StringBuilder(260);
+ SHGetSpecialFolderPath(IntPtr.Zero, path, CSIDL_STARTUP, false);
+ return path.ToString();
+ }
+ }
+}
diff --git a/DuckDNS/bin/Debug/DuckDNS.exe b/DuckDNS/bin/Debug/DuckDNS.exe
index 90b048e..11f53e0 100644
Binary files a/DuckDNS/bin/Debug/DuckDNS.exe and b/DuckDNS/bin/Debug/DuckDNS.exe differ