Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Fixed throwing an ExternalException to user #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ClipboardMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,17 @@ protected override void WndProc(ref Message m)

private void ClipChanged()
{
IDataObject iData = System.Windows.Forms.Clipboard.GetDataObject();
IDataObject iData = null;
try
{
iData = System.Windows.Forms.Clipboard.GetDataObject();
}
catch (ExternalException)
{
// The internal implements will raise the ExternalExcption
// when the clipboard is being used by the another process.
return;
}

ClipboardFormat? format = null;

Expand Down Expand Up @@ -231,4 +241,4 @@ public enum ClipboardFormat : byte
/// <filterpriority>1</filterpriority>
Serializable,
}
}
}