public void SetText(string text) { if (!WinClipboard.SetText(text)) { ISLogger.Write("WindowsClipboardMonitor: Failed to set text: Win32 code {0}", Marshal.GetLastWin32Error().ToString("X")); return; } }
//Writes a string to the clipboard //--This method needs be invoked on the dedicated desktop thread! private void SetClipboard(string text) { ignoreClipboardData = true; if (!WinClipboard.SetText(text)) { ISLogger.Write("Failed to set clipboard text: Win32 code {0}", Marshal.GetLastWin32Error().ToString("X")); return; } ISLogger.Write("Clipboard text set"); }
private void CbMonitorWindow_ClipboardContentChanged(object sender, EventArgs e) { string text = WinClipboard.ReadText(); if (text == null) { ISLogger.Write("WindowsClipboardMonitor: Failed to read clipboard: win32 code {0}", Marshal.GetLastWin32Error().ToString("X")); return; } TextCopied?.Invoke(this, text); }
//This method reads the text (if any) from the clipboard //--This method needs be invoked on the dedicated desktop thread! private void ReadClipboard() { string str = WinClipboard.ReadText(); if (str == null) { ISLogger.Write("GetClipboardText returned null"); return; } ipcWrite.SendClipboardTextCopied(str); }
private void MsgWindow_ClipboardContentChanged(object sender, EventArgs e) { string text = WinClipboard.ReadText(); if (text == null) { return; } ISLogger.Write("INPUTMANAGER->OnClipboardCopied"); inputQueue?.Add(new Win32Msg { wParam = INPUTSHARE_CLIPBOARDTEXTCOPY, cbText = text }); }
private void C_ClipboardTextCopied(object sender, string cbText) { if (cbText == null) { ISLogger.Write("Warning: Copied null string from clipboard"); return; } //ISLogger.Write($"{(sender as ConnectedClient).ClientName} copied {e}"); ignoreClipboard = true; if (!WinClipboard.SetText(cbText)) { ISLogger.Write("IsServer: Failed to set clipboard text"); } ConnectedClient senderClient = sender as ConnectedClient; foreach (var client in clientMan.AllClients) { if (client != senderClient && client != ConnectedClient.LocalHost) { client?.SetClipboardText(cbText); } } }