diff --git a/WeeXnes/MVVM/View/SettingView.xaml b/WeeXnes/MVVM/View/SettingView.xaml
index 23fdb40..c67e6b5 100644
--- a/WeeXnes/MVVM/View/SettingView.xaml
+++ b/WeeXnes/MVVM/View/SettingView.xaml
@@ -61,6 +61,14 @@
Height="25"
Click="CheckForUpdateBtn_OnClick"
Margin="4,10,4,0"/>
+
+
diff --git a/WeeXnes/MVVM/View/SettingView.xaml.cs b/WeeXnes/MVVM/View/SettingView.xaml.cs
index d61b93a..334bf07 100644
--- a/WeeXnes/MVVM/View/SettingView.xaml.cs
+++ b/WeeXnes/MVVM/View/SettingView.xaml.cs
@@ -297,5 +297,19 @@ namespace WeeXnes.MVVM.View
}
+
+ private void CreateShortcut_OnClick(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ Process p = Process.Start("WeeXnes_UAC.exe", "-CreateStartMenuShortcut");
+ p.WaitForExit();
+ }
+ catch (Exception ex)
+ {
+ Misc.Message message = new Misc.Message(ex.ToString());
+ message.Show();
+ }
+ }
}
}
diff --git a/WeeXnes_UAC/App.xaml.cs b/WeeXnes_UAC/App.xaml.cs
index b129ed6..a53c8e8 100644
--- a/WeeXnes_UAC/App.xaml.cs
+++ b/WeeXnes_UAC/App.xaml.cs
@@ -1,6 +1,9 @@
using System;
+using System.IO;
using System.Windows;
+using IWshRuntimeLibrary;
using Microsoft.Win32;
+using Application = System.Windows.Forms.Application;
namespace WeeXnes_UAC
{
@@ -25,6 +28,11 @@ namespace WeeXnes_UAC
{
disableAutostart();
}
+
+ if (e.Args[i] == "-CreateStartMenuShortcut")
+ {
+ AddShortcut();
+ }
}
}
else
@@ -32,7 +40,28 @@ namespace WeeXnes_UAC
MessageBox.Show("No Arguments");
}
}
-
+ private static void AddShortcut()
+ {
+
+ string path = Application.StartupPath;
+ string fileName = "WeeXnes.exe";
+ string pathToExe = path + "\\" + fileName;
+ string commonStartMenuPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu);
+ Console.WriteLine(commonStartMenuPath);
+ string appStartMenuPath = Path.Combine(commonStartMenuPath, "Programs", "WeeXnes");
+
+ if (!Directory.Exists(appStartMenuPath))
+ Directory.CreateDirectory(appStartMenuPath);
+
+ string shortcutLocation = Path.Combine(appStartMenuPath, "WeeXnes Suite" + ".lnk");
+ WshShell shell = new WshShell();
+ IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);
+
+ shortcut.Description = "WeeXnes Tool Suite";
+ //shortcut.IconLocation = @"C:\Program Files (x86)\TestApp\TestApp.ico"; //uncomment to set the icon of the shortcut
+ shortcut.TargetPath = pathToExe;
+ shortcut.Save();
+ }
private void disableAutostart()
{
RegistryKey key = Registry.CurrentUser.CreateSubKey(subkey);
diff --git a/WeeXnes_UAC/WeeXnes_UAC.csproj b/WeeXnes_UAC/WeeXnes_UAC.csproj
index 3983ca9..7fff9b4 100644
--- a/WeeXnes_UAC/WeeXnes_UAC.csproj
+++ b/WeeXnes_UAC/WeeXnes_UAC.csproj
@@ -1,7 +1,6 @@
-
+
Debug
AnyCPU
@@ -25,6 +24,9 @@
prompt
4
+
+ app.manifest
+
AnyCPU
pdbonly
@@ -35,16 +37,18 @@
4
-
-
-
-
+
+
+
+
+
+
4.0
-
-
-
+
+
+
@@ -79,7 +83,21 @@
-
+
-
+
+
+ {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}
+ 1
+ 0
+ 0
+ tlbimp
+ False
+ True
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WeeXnes_UAC/app.manifest b/WeeXnes_UAC/app.manifest
new file mode 100644
index 0000000..a1cbb6d
--- /dev/null
+++ b/WeeXnes_UAC/app.manifest
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file