Skip to content

Commit

Permalink
Added button to open screenshots folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarasovych committed Jan 7, 2018
1 parent d664a1b commit 97ca111
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
15 changes: 14 additions & 1 deletion CaptureSave/CaptureSave.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions CaptureSave/CaptureSave.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;

Expand All @@ -9,7 +10,6 @@ namespace CaptureSave

public partial class CaptureSave : Form
{
// DLL libraries used to manage hotkeys
[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
[DllImport("user32.dll")]
Expand All @@ -20,12 +20,14 @@ public partial class CaptureSave : Form
private int screenWidth = Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width);
private int screenHeight = Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height);

private string filePath = AppDomain.CurrentDomain.BaseDirectory + "\\img\\";

public CaptureSave()
{
InitializeComponent();
LoadResolution();
LoadHotkey();
RegisterHotKey(this.Handle, MYACTION_HOTKEY_ID, 3, (int)Keys.S);
RegisterHotKey(this.Handle, MYACTION_HOTKEY_ID, 5, (int)Keys.S);
}

public void LoadResolution()
Expand All @@ -50,8 +52,6 @@ protected override void WndProc(ref Message m)
g.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
}

string filePath = AppDomain.CurrentDomain.BaseDirectory + "\\img\\";

System.IO.FileInfo file = new System.IO.FileInfo(filePath);
file.Directory.Create();

Expand All @@ -61,5 +61,16 @@ protected override void WndProc(ref Message m)
}
base.WndProc(ref m);
}

private void buttonOpenFolder_Click(object sender, EventArgs e)
{
if (Directory.Exists(filePath))
{
System.Diagnostics.Process.Start(filePath);
} else
{
MessageBox.Show("Try to make screenshots first.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

0 comments on commit 97ca111

Please sign in to comment.