Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
Enum Equates Singular
IDC_Button
End Enum
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "PowerBASIC",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local w,h As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
If GetClipboardBitmapSize(w,h) Then
? "Bitmap size: " + Str$(w)+"x"+Trim$(Str$(h))
Else
? "No Bitmap found!"
End If
End Select
End Select
End Function
Function GetClipboardBitmapSize(w As Long, h As Long) As Long
Local hBMP As Dword, iResult As Long
Clipboard Get Bitmap To hBmp, iResult
Graphic Attach hBMP, 0
Graphic Get Canvas To w,h
Function = iResult
End Function
'gbs_01220
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm