From 9cd37dd81b4bee8b42f4b4e13b2e2d5ec8648e0a Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:39:40 -0400 Subject: [PATCH] Use ImGui::SetClipboardText instead of inline function. (#1902) --- src/views/debug/view_debug_threads.cpp | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/views/debug/view_debug_threads.cpp b/src/views/debug/view_debug_threads.cpp index 52c9ca23..7071de57 100644 --- a/src/views/debug/view_debug_threads.cpp +++ b/src/views/debug/view_debug_threads.cpp @@ -32,28 +32,6 @@ namespace namespace big { - static void set_clipboard(const char* message) - { - HGLOBAL h; - LPVOID p; - int size; - //calc the num of unicode char - size = MultiByteToWideChar(CP_UTF8, NULL, message, -1, NULL, 0); - if (!size) - return; - h = GlobalAlloc(GHND | GMEM_SHARE, size * 2); - if (!h) - return; - p = GlobalLock(h); - //utf8 to unicode - MultiByteToWideChar(CP_UTF8, NULL, message, -1, (LPWSTR)p, size); - GlobalUnlock(h); - OpenClipboard(NULL); - EmptyClipboard(); - SetClipboardData(CF_UNICODETEXT, h); - CloseClipboard(); - } - void debug::threads() { if (ImGui::BeginTabItem("Threads")) @@ -129,12 +107,12 @@ namespace big ImGui::Text("Script Pointer: "); ImGui::SameLine(); if (ImGui::Button(std::format("0x{:X}", (DWORD64)selected_thread).c_str())) - set_clipboard(std::format("0x{:X}", (DWORD64)selected_thread).c_str()); + ImGui::SetClipboardText(std::format("0x{:X}", (DWORD64)selected_thread).c_str()); //Stack Pointer ImGui::Text("Stack Pointer: "); ImGui::SameLine(); if (ImGui::Button(std::format("0x{:X}", (DWORD64)selected_thread->m_stack).c_str())) - set_clipboard(std::format("0x{:X}", (DWORD64)selected_thread->m_stack).c_str()); + ImGui::SetClipboardText(std::format("0x{:X}", (DWORD64)selected_thread->m_stack).c_str()); ImGui::SameLine(); ImGui::Text("Internal Stack Pointer: %d Stack Size: %d", selected_thread->m_context.m_stack_pointer, selected_thread->m_context.m_stack_size);