Capture Web Page 3

Category: Jose Roca

Date: 02-16-2022

Return to Index


 
'Compilable Example:  (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
 
Enum Equates Singular
   IDC_Button = 500
   IDC_TextBox
End Enum
 
Global hDlg,hTextBox,hButton As Dword
 
Function PBMain() As Long
   Dialog New Pixels, 0, "PowerBASIC",300,300,250,100, %WS_OverlappedWindow To hDlg
   Control Add Button, hDlg, %IDC_Button,"Capture OffScreen TextBox", 10,10,180,20
   Control Handle hDlg, %IDC_Button To hButton
   Control Add TextBox, hDlg, %IDC_TextBox,"OffScreen TextBox", 10,100,150,20
   Control Handle hDlg, %IDC_TextBox To hTextBox
   Dialog Show Modal hDlg Call DlgProc
End Function
 
CallBack Function DlgProc() As Long
   Local hBMP,hDC_Graphic,hDC_TextBox As Dword
   Select Case Cb.Msg
      Case %WM_Command
         Select Case Cb.Ctl
            Case %IDC_Button
               'create memory DC
               Graphic Bitmap New 150,20 To hBMP
               Graphic Attach hBMP, 0
               Graphic Get DC To hDC_Graphic
               'create TextBox DC
               hDC_TextBox = GetWindowDC(hTextBox)
               'copy textbox to memory DC
'               BitBlt hDC_Graphic,0,0,150,20,hDC_TextBox,0,0,%SRCCopy
               StretchBlt hDC_Graphic,0,0,150,20,hDC_TextBox,0,0,150,20,%SRCCopy
               Graphic ReDraw
               'put memory bitmap on clipboard
               Clipboard Reset
               Clipboard Set Bitmap hBMP
               'cleanup
               ReleaseDC hTextBox, hDC_TextBox
               Graphic Bitmap End
               ? "TextBox image placed on clipboard!"
         End Select
   End Select
End Function
 
'gbs_01434
'Date: 10-17-2014              


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm