diff --git a/.vsconfig b/.vsconfig
new file mode 100644
index 0000000..726579a
--- /dev/null
+++ b/.vsconfig
@@ -0,0 +1,93 @@
+{
+ "version": "1.0",
+ "components": [
+ "Microsoft.VisualStudio.Component.CoreEditor",
+ "Microsoft.VisualStudio.Workload.CoreEditor",
+ "Microsoft.NetCore.Component.Runtime.3.1",
+ "Microsoft.NetCore.Component.SDK",
+ "Microsoft.VisualStudio.Component.NuGet",
+ "Microsoft.Net.Component.4.6.1.TargetingPack",
+ "Microsoft.VisualStudio.Component.Roslyn.Compiler",
+ "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
+ "Microsoft.VisualStudio.Component.FSharp",
+ "Microsoft.NetCore.Component.DevelopmentTools",
+ "Microsoft.VisualStudio.Component.FSharp.WebTemplates",
+ "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
+ "Microsoft.VisualStudio.Component.DockerTools",
+ "Microsoft.NetCore.Component.Web",
+ "Microsoft.Net.Component.4.8.SDK",
+ "Microsoft.Net.Component.4.7.2.TargetingPack",
+ "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
+ "Microsoft.VisualStudio.Component.TypeScript.3.9",
+ "Microsoft.VisualStudio.Component.JavaScript.TypeScript",
+ "Microsoft.VisualStudio.Component.JavaScript.Diagnostics",
+ "Microsoft.Component.MSBuild",
+ "Microsoft.VisualStudio.Component.TextTemplating",
+ "Component.Microsoft.VisualStudio.RazorExtension",
+ "Microsoft.VisualStudio.Component.IISExpress",
+ "Microsoft.VisualStudio.Component.SQL.ADAL",
+ "Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime",
+ "Microsoft.VisualStudio.Component.Common.Azure.Tools",
+ "Microsoft.VisualStudio.Component.SQL.CLR",
+ "Microsoft.VisualStudio.Component.MSODBC.SQL",
+ "Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils",
+ "Microsoft.VisualStudio.Component.ManagedDesktop.Core",
+ "Microsoft.Net.Component.4.5.2.TargetingPack",
+ "Microsoft.Net.Component.4.5.TargetingPack",
+ "Microsoft.VisualStudio.Component.SQL.SSDT",
+ "Microsoft.VisualStudio.Component.SQL.DataSources",
+ "Component.Microsoft.Web.LibraryManager",
+ "Microsoft.VisualStudio.ComponentGroup.Web",
+ "Microsoft.VisualStudio.Component.Web",
+ "Microsoft.VisualStudio.Component.IntelliCode",
+ "Microsoft.Net.Component.4.TargetingPack",
+ "Microsoft.Net.Component.4.5.1.TargetingPack",
+ "Microsoft.Net.Component.4.6.TargetingPack",
+ "Microsoft.Net.ComponentGroup.TargetingPacks.Common",
+ "Microsoft.Net.Core.Component.SDK.2.1",
+ "Component.Microsoft.VisualStudio.Web.AzureFunctions",
+ "Microsoft.VisualStudio.ComponentGroup.AzureFunctions",
+ "Microsoft.VisualStudio.Component.Azure.Compute.Emulator",
+ "Microsoft.VisualStudio.Component.Azure.Storage.Emulator",
+ "Microsoft.VisualStudio.Component.Azure.ClientLibs",
+ "Microsoft.VisualStudio.Component.Azure.AuthoringTools",
+ "Microsoft.VisualStudio.Component.CloudExplorer",
+ "Microsoft.VisualStudio.ComponentGroup.Web.CloudTools",
+ "Microsoft.VisualStudio.Component.DiagnosticTools",
+ "Microsoft.VisualStudio.Component.EntityFramework",
+ "Microsoft.VisualStudio.Component.AspNet45",
+ "Microsoft.VisualStudio.Component.AppInsights.Tools",
+ "Microsoft.VisualStudio.Component.WebDeploy",
+ "Component.Microsoft.VisualStudio.LiveShare",
+ "Microsoft.Net.Component.4.7.1.TargetingPack",
+ "Microsoft.VisualStudio.Workload.NetWeb",
+ "Microsoft.VisualStudio.Component.VC.CoreIde",
+ "Microsoft.VisualStudio.Component.Windows10SDK",
+ "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
+ "Microsoft.VisualStudio.Component.Graphics.Tools",
+ "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
+ "Microsoft.VisualStudio.Component.Windows10SDK.18362",
+ "Microsoft.VisualStudio.Component.Node.Tools",
+ "Microsoft.VisualStudio.Workload.Node",
+ "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
+ "Microsoft.ComponentGroup.Blend",
+ "Microsoft.VisualStudio.Component.Debugger.JustInTime",
+ "Microsoft.VisualStudio.Component.DotNetModelBuilder",
+ "Microsoft.VisualStudio.Workload.ManagedDesktop",
+ "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
+ "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
+ "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
+ "Microsoft.VisualStudio.Component.VC.CMake.Project",
+ "Microsoft.VisualStudio.Component.VC.ATL",
+ "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
+ "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
+ "Microsoft.VisualStudio.Component.VC.ASAN",
+ "Microsoft.VisualStudio.Workload.NativeDesktop",
+ "Microsoft.Net.Component.3.5.DeveloperTools",
+ "Microsoft.VisualStudio.Component.Unity",
+ "Component.UnityEngine.x64",
+ "Component.UnityEngine.x86",
+ "Microsoft.VisualStudio.Workload.ManagedGame",
+ "Microsoft.VisualStudio.Workload.NativeGame"
+ ]
+}
\ No newline at end of file
diff --git a/TextSpeech/Program.cs b/TextSpeech/Program.cs
index f362b7d..24ee83a 100644
--- a/TextSpeech/Program.cs
+++ b/TextSpeech/Program.cs
@@ -5,6 +5,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
+using System.Text;
+using System.IO;
+using IWshRuntimeLibrary;
namespace TextSpeech
{
@@ -15,7 +18,12 @@ static class Program
private static LowLevelKeyboardProc _proc = HookCallback;
private static IntPtr _hookID = IntPtr.Zero;
public static TextSpeaker speaker;
-
+ const int CSIDL_COMMON_STARTUP = 0x0018;
+ const int CSIDL_STARTUP = 0x0018;
+
+ [DllImport("shell32.dll")]
+ static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, bool fCreate);
+
[STAThread]
static void Main()
{
@@ -24,10 +32,92 @@ static void Main()
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
speaker = new TextSpeaker();
+ //check to see if the app.exe exist in the startup folder
+ CreateStartupShortcut();
Application.Run(speaker);
UnhookWindowsHookEx(_hookID);
+
}
+
+ public static string FindStartupFolder()
+ {
+ String path;
+ //SHGetSpecialFolderPath(IntPtr.Zero, path, CSIDL_COMMON_STARTUP, false);
+ path = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
+ return path.ToString();
+ }
+ private static string getAppShortcutFileName()
+ {
+ return Path.Combine(FindStartupFolder(), Application.ProductName) + ".lnk";
+ }
+ public static bool CheckStartupFileExist()
+ {
+ return System.IO.File.Exists(getAppShortcutFileName());
+ }
+ public static string Createlocalshortcut()
+ {
+ //TODO: this method needs to be fixed
+ string shortcutPath = Application.StartupPath;
+ string shortcutLocation = System.IO.Path.Combine(shortcutPath, @"textSpeech" + ".lnk");
+
+ //Create all users desktop shortcut for application settings
+ WshShell shell = new WshShell();
+ IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);
+ shortcut.TargetPath = Application.ExecutablePath;
+ shortcut.IconLocation = @"icon1";
+ shortcut.Description = "Description";
+ shortcut.Save();
+
+ return shortcutLocation;
+
+ }
+ public static bool CreateStartupShortcut()
+ {
+ //Createlocalshortcut();
+ bool retval = false;
+ string shortcutName = Createlocalshortcut();
+ FileInfo shortcutFile = new FileInfo(shortcutName);
+ FileInfo destination = new FileInfo(getAppShortcutFileName());
+
+ if (destination.Exists)
+ {
+ //run overwrite code
+ retval = CopyShortcut(shortcutFile,destination);
+ }
+ else if (!shortcutFile.Exists)
+ {
+ MessageBox.Show("Unable to RunOnStartup becasue the local shortcut cant be found.");
+ }
+ else
+ {
+ retval = CopyShortcut(shortcutFile,destination);
+ }
+
+
+ return retval;
+ }
+ public static bool CopyShortcut(FileInfo src, FileInfo dest)
+ {
+ bool retVal = false;
+ try
+ {
+ //System.IO.File.Copy(src.FullName, dest.FullName, true); you need to run this to overwrite the file
+ System.IO.File.Copy(src.FullName,dest.FullName);
+ retVal = true;
+ }
+ catch (UnauthorizedAccessException authEX)
+ {
+ MessageBox.Show(string.Format("UnauthorizedAccessException: {0}",authEX.Message), "Copy Shortcut", MessageBoxButtons.OK, MessageBoxIcon.Error);
+
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Copy Shortcut", MessageBoxButtons.OK, MessageBoxIcon.Error);
+
+ }
+ return retVal;
+ }
///
/// This method sets up the windows hook for the keyboard proc
///
@@ -74,6 +164,7 @@ private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string lpModuleName);
+
}
#endregion
diff --git a/TextSpeech/Properties/Resources.Designer.cs b/TextSpeech/Properties/Resources.Designer.cs
index 7efe0b2..d8036dc 100644
--- a/TextSpeech/Properties/Resources.Designer.cs
+++ b/TextSpeech/Properties/Resources.Designer.cs
@@ -69,15 +69,5 @@ internal static System.Drawing.Icon icon1 {
return ((System.Drawing.Icon)(obj));
}
}
-
- ///
- /// Looks up a localized resource of type System.Drawing.Bitmap.
- ///
- internal static System.Drawing.Bitmap totallyradshowbg {
- get {
- object obj = ResourceManager.GetObject("totallyradshowbg", resourceCulture);
- return ((System.Drawing.Bitmap)(obj));
- }
- }
}
}
diff --git a/TextSpeech/Properties/Resources.resx b/TextSpeech/Properties/Resources.resx
index 801b646..e4f0c68 100644
--- a/TextSpeech/Properties/Resources.resx
+++ b/TextSpeech/Properties/Resources.resx
@@ -121,7 +121,4 @@
..\Resources\icon1.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\totallyradshowbg.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
\ No newline at end of file
diff --git a/TextSpeech/TextSpeech.csproj b/TextSpeech/TextSpeech.csproj
index d256e18..30a93f7 100644
--- a/TextSpeech/TextSpeech.csproj
+++ b/TextSpeech/TextSpeech.csproj
@@ -14,7 +14,7 @@
true
false
- C:\Users\white\Desktop\New folder\
+ C:\Users\white\Desktop\test\
true
Disk
false
@@ -24,7 +24,6 @@
false
false
true
- true
6
1.0.0.%2a
false
@@ -78,6 +77,10 @@
+
+
+ LocalIntranet
+
@@ -130,11 +133,6 @@
-
- False
- Microsoft .NET Framework 4.5.2 %28x86 and x64%29
- true
-
False
.NET Framework 3.5 SP1
@@ -146,7 +144,17 @@
-
+
+
+ {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}
+ 1
+ 0
+ 0
+ tlbimp
+ False
+ True
+
+