How do I save virtual window images

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

How do I save virtual window images

Post by huiyi_ch »

Hello, guys
I need to save the image in the virtual window, but I don't know how to do it. Please help me solve it.
Thanks
User avatar
AUGE_OHR
Posts: 2062
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: How do I save virtual window images

Post by AUGE_OHR »

hi,
huiyi_ch wrote: Sun Jul 12, 2020 1:07 am I need to save the image in the virtual window, but I don't know how to do it.
this Code save Context of Window except Statusbar

Code: Select all

METHOD SaveBitmap() CLASS DemoForm
LOCAL nWidth  := GetProperty( "MainForm", "ClientAreaWidth" )
LOCAL nHeight := GetProperty( "MainForm", "ClientAreaHeight" )
LOCAL nSB, aRect := { 0, 0, 0, 0 }
LOCAL cFile
   // get height of Statusbar
   nSB := GetControlHandle( "STATUSBAR", "MainForm" )
   IF !EMPTY( nSB )
      GetWindowRect( nSB, @aRect )
   ENDIF
   nHeight -= ( aRect[ 4 ] - aRect[ 2 ] )   // reduce height of STATUSBAR
   // get Name to save Bitmap
   cFile := GetInPut( "Bitmap", "save Bitmap", "DLT.BMP", 1 )
   IF EMPTY( cFile )
   ELSE
      IF FILE( cFile )
         FERASE( cFile )
      ENDIF
      // make snapshot
      Domethod( "MainForm", "Capture", cFile, 0, 0, nWidth, nHeight )
   ENDIF
RETURN NIL
you can pass "Mainform" as Parameter and use Macro cForm (no " ")
have fun
Jimmy
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: How do I save virtual window images

Post by srvet_claudio »

Hi,
See doc and Bos Taurus demo:

hBitmap := BT_BitmapCaptureClientArea (Win, Row, Col, Width, Height)

BT_BitmapSaveFile (hBitmap, cFileName, nTypePicture)
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: How do I save virtual window images

Post by huiyi_ch »

Thank you srvet_claudio ,
Thank you AUGE_OHR .
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: How do I save virtual window images

Post by huiyi_ch »

Hi,
I want to save the full image in the virtual window, including the invisible part beyond the screen size.
In tests, these functions save only the visible part of the window, and the invisible part beyond the screen size is still not saved.
User avatar
AUGE_OHR
Posts: 2062
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: How do I save virtual window images

Post by AUGE_OHR »

huiyi_ch wrote: Fri Jul 24, 2020 3:35 am Hi,
I want to save the full image in the virtual window, including the invisible part beyond the screen size.
In tests, these functions save only the visible part of the window, and the invisible part beyond the screen size is still not saved.
change

Code: Select all

LOCAL nWidth  := GetProperty( "MainForm", "ClientAreaWidth" )
LOCAL nHeight := GetProperty( "MainForm", "ClientAreaHeight" )
to

Code: Select all

LOCAL nWidth  := GetProperty( "MainForm", "Width" )
LOCAL nHeight := GetProperty( "MainForm", "Height" )
have fun
Jimmy
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: How do I save virtual window images

Post by srvet_claudio »

Hi,
it is not possible, in a virtual window the SO only paints the visible part of the controls. The invisible part is only painted when the user scrolls the scroll bar.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: How do I save virtual window images

Post by huiyi_ch »

Thank you srvet_claudio.
Post Reply