Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........
Started by billhsln, June 17, 2019, 11:37:21 am
0 Members and 1 Guest are viewing this topic.
SUB CopyStringToClipboard(INT hwnd, string text) UINT handle = GlobalAlloc(GHND, LEN(text) + 1) POINTER lock = GlobalLock(handle) memcpy(lock, text, LEN(text) + 1) GlobalUnlock(handle) OpenClipboard(hwnd) EmptyClipboard() SetClipboardData(CF_TEXT, handle) CloseClipboard() GlobalFree(handle) 'note: this line is not present in any example at all but I'm pretty sure that its absence will produce a memory leak :/ENDSUB
Quote from: billhslnI will also keep the info on the WSTRING, even though I have not yet found a need for it.
2 * LEN(text) + 2