Skip to content

Commit

Permalink
Clipboard monitoring will now check while running.
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-Kimura committed Feb 6, 2019
1 parent ea1e58c commit 109c142
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
15 changes: 0 additions & 15 deletions SharpCliboard.Tests/MainForm.Designer.cs

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

6 changes: 4 additions & 2 deletions SharpCliboard.Tests/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ private void sharpClipboard1_ClipboardChanged(object sender, SharpClipboard.Clip
// lstCopiedFiles.Items.AddRange(((List<string>)e.Content).ToArray()));
}

textBox1.Text = $"Name: {e.SourceApplication.Name}, Title: {e.SourceApplication.Title}, " +
$"ID: {e.SourceApplication.ID}, Path: {e.SourceApplication.Path}";
// Add a TextBox, uncomment the lines below and run.
// -------------------------------------------------
// textBox1.Text = $"Name: {e.SourceApplication.Name}, Title: {e.SourceApplication.Title}, " +
// $"ID: {e.SourceApplication.ID}, Path: {e.SourceApplication.Path}";
}
}
}
12 changes: 4 additions & 8 deletions SharpClipboard/Views/ClipboardHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,15 @@ private string GetActiveWindowTitle()
private void OnLoad(object sender, EventArgs e)
{
// Start listening for clipboard changes.
if (SharpClipboardInstance.MonitorClipboard)
_chainedWnd = SetClipboardViewer(this.Handle);
_chainedWnd = SetClipboardViewer(this.Handle);
}

private void OnFormClosing(object sender, FormClosingEventArgs e)
{
if (SharpClipboardInstance.MonitorClipboard)
{
// Stop listening to clipboard changes.
ChangeClipboardChain(this.Handle, _chainedWnd);
// Stop listening to clipboard changes.
ChangeClipboardChain(this.Handle, _chainedWnd);

_chainedWnd = IntPtr.Zero;
}
_chainedWnd = IntPtr.Zero;
}

#endregion
Expand Down

0 comments on commit 109c142

Please sign in to comment.