forked from jparnell8839/AlwaysOnTop
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
68 lines (64 loc) · 2.31 KB
/
Program.cs
File metadata and controls
68 lines (64 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/********************************************
* AlwaysOnTop
* Code: Joshua Parnell
* Site: https://github.com/jparnell8839/AlwaysOnTop
* Version: 0.5.2
* Build: 170106.2235
* Date: 2017.01.10
* Credits: John Parnell for assistance with original AutoIt version's aot() logic
* Sayka & dimitris93 for the cursor changing logic
* http://stackoverflow.com/questions/29781271/setsystemcursor-for-multiple-cursors-behavior
* Hans Passant for the left click logic to bring the context menu
* http://stackoverflow.com/questions/2208690/invoke-notifyicons-context-menu/
* Jorge Ferreira for window title logic
* http://stackoverflow.com/questions/115868/how-do-i-get-the-title-of-the-current-active-window-using-c
* StormySpike for the use of the globalKeyboardHook class
* https://www.codeproject.com/kb/cs/csllkeyboardhook.aspx
* Jon Egerton for enabling the modifer keys on globalKeyboardHook
* http://www.jonegerton.com/dotnet/determining-the-state-of-modifier-keys-when-hooking-keyboard-input/
* Octokit for the GitHub API classes and updating
* https://github.com/octokit/octokit.net
*
********************************************/
using AlwaysOnTop.Classes;
using System;
using System.IO;
using System.Threading;
using System.Windows.Forms;
namespace AlwaysOnTop
{
static class Program
{
static Mutex mutex = new Mutex(true, "{30c38296-da36-40ce-903d-2e51c721317c}");
/// <summary>
/// The main entry point for the application.
/// </summary>
///
[STAThread]
static void Main(string[] args)
{
if (!mutex.WaitOne(TimeSpan.Zero, true))
{
return;
}
var path = AppDomain.CurrentDomain.BaseDirectory + "\\AoT_Error.log";
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
{
Application.Run(new AlwaysOnTopApplicationContext(args));
}
catch (Exception ex)
{
using (var error = new StreamWriter(path, true))
{
error.WriteLine(DateTime.Now + ": " + ex.Message);
}
}
finally
{
mutex.ReleaseMutex();
}
}
}
}