Date: 02-16-2022
Return to Index
created by gbSnippets
' OpenClipboard %Null
' EmptyClipboard
' SetClipBoardData %CF_Bitmap, hBMP
' CloseClipboard
'gbs_00489
'Date: 03-10-2012
'The PowerBASIC Clipboard statement is used to get/set clipboard images.
'ClipBoard ReSet must be used before using any other ClipBoard statement
'Primary Code:
Clipboard Reset 'clear clipboard
Clipboard Get Text TO txt$ 'get text
Clipboard Set Text txt$ 'set text
'Compilable Example: (Jose Includes)
'This example copies text from a textbox and puts it on the clipboard
'It can also read whatever is on the clipboard and paste it in a 2nd textbox
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Resource "gbsnippets.pbr"
Global hDlg As DWord
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Put BMP", 20,10,70,20
Control Add Button, hDlg, 300,"Get BMP", 110,10,70,20
Control Add Graphic, hDlg, 200,"cowgirl", 50,60,100,100, %WS_Visible Or %SS_Sunken Or %SS_Notify
Graphic Attach hDlg, 200
Graphic Render "cowgirl", (0,0)-(100,100) 'same size (could resize)
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local temp$
Local hClip, hGraphic As DWord
Select Case CB.Msg
Case CB.Msg
Select Case CB.Ctl
Case 100
Clipboard Reset
Control Handle hDlg, 200 To hGraphic 'handle to graphic control
Clipboard Set Bitmap hGraphic 'send content of graphic control to clipboard
Case 300
Clipboard Get Bitmap To hClip 'new Graphic Bitmap
Graphic Copy hClip, 0
End Select
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm