Originally posted by Steve Bouffe
View Post
Code:
'<== Start of Clipboard as an Include ==> 'Clipboard stuff gotten from Poffs but I forget from whom ' 'Note t$ must be initialized - Local t$ Function Clipboard_Set_Text Alias "Clipboard_Set_Text" _ (ByVal sText As String) Export As Long Local hData As Long, hGlob As Long ' ** Create a global memory object and copy the data into it hData = GlobalAlloc(%GMEM_MOVEABLE Or %GMEM_DDESHARE, Len(sText) + 1) hGlob = GlobalLock(hData) Poke$ hGlob, sText + Chr$(0) GlobalUnlock hData ' ** Open the clipboard If IsFalse(OpenClipboard(%Null)) Then GlobalFree hData Exit Function End If ' ** Paste the data into the clipboard EmptyClipboard 'WinAPI Function = SetClipboardData(%CF_TEXT, hData) 'WinAPI CloseClipboard 'WinAPI End Function Function Clipboard_Get_Text Alias "Clipboard_Get_Text"() Export As String Local zPtr As Asciiz Ptr OpenClipboard 0 'WinAPI zPtr = GetClipboardData(%CF_TEXT) If zPtr <> 0 Then Function = @zPtr CloseClipboard 'WinAPI End Function ' ' Macro Get_Clipboard = t$ = Clipboard_Get_Text 'put cb in tb at program start ' Macro Set_Clipboard = Clipboard_Set_Text(t$) ' '<== End of Clipboard as an Include ==>
Talk sense to a fool and he calls you foolish.
Euripides
===============================================
Leave a comment: