I need to pass a string to the Win32 API function 'SetClipboardData' but I'm not having much luck ...
What I'm attempting to do is place a string of characters into the clipboard. I've tried various methods but the string does not arrive there.
SetClipboardData wants an INT which is a handle to the string of text. In the example here I'm converting the text to a sequence of bytes and passing the results as an INT.
No luck though. Any ideas how you do this?
What I'm attempting to do is place a string of characters into the clipboard. I've tried various methods but the string does not arrive there.
SetClipboardData wants an INT which is a handle to the string of text. In the example here I'm converting the text to a sequence of bytes and passing the results as an INT.
No luck though. Any ideas how you do this?
' clipboard paste text example Extern "Win32" Function OpenClipboard%(hwnd%) Function CloseClipboard%() Function EmptyClipboard%() Function SetClipboardData%(format%,hMem%) End Extern ' ----------------------------------------------- Global txt$="Hello from BlitzMax!" Const CF_TEXT=1 If OpenClipboard(0) EmptyClipboard SetClipboardData CF_TEXT, Int(txt.ToCString()) CloseClipboard FlushMem Else RuntimeError "Failed to open Clipboard" EndIf End