User Tools

Site Tools


capturing_20the_20contents_20of_20a_20window

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
capturing_20the_20contents_20of_20a_20window [2018/04/13 14:53]
richardrussell Added syntax highlighting
capturing_20the_20contents_20of_20a_20window [2018/04/16 14:41] (current)
richardrussell Tidied up formatting
Line 1: Line 1:
 =====Capturing the contents of a window===== =====Capturing the contents of a window=====
  
-//by Richard Russell, May 2007 (updated)//​\\ \\  You can //​capture//,​ as a bitmap file, the contents of your program'​s main output window using the ***SCREENSAVE** (or ***GSAVE**) command. But what if you want to save not your output window but the contents of a dialogue box, Direct3D window or other window? There is no equivalent built-in command to do that.\\ \\  The procedures listed below will capture to a file the contents of the window whose handle is specified. If one doesn'​t work the other probably will. The procedures as listed save the image as a BMP file; if you want to use a different file format change **PROCsaveasbmp(hbm%,​ file$)** to [[/​Saving%20a%20GIF%20image|PROCsavegif(hbm%,​ file$)]] or [[/​Saving%20a%20JPEG%20image|PROCsavejpg(hbm%,​ file$, quality%)]] etc. as appropriate.\\ \\ +//by Richard Russell, May 2007 (updated)//​\\ \\  You can //​capture//,​ as a bitmap file, the contents of your program'​s main output window using the ***SCREENSAVE** (or ***GSAVE**) command. But what if you want to save not your output window but the contents of a dialogue box, Direct3D window or other window? There is no equivalent built-in command to do that.\\ \\  The procedures listed below will capture to a file the contents of the window whose handle is specified. If one doesn'​t work the other probably will. The procedures as listed save the image as a BMP file; if you want to use a different file format change **PROCsaveasbmp(hbm%,​ file$)** to [[/​Saving%20a%20GIF%20image|PROCsavegif(hbm%,​ file$)]] or [[/​Saving%20a%20JPEG%20image|PROCsavejpg(hbm%,​ file$, quality%)]] etc. as appropriate. 
 ===== Method one ===== ===== Method one =====
-\\  ​This method is most appropriate for dialogue boxes and other child windows. It will work even if the window is wholly or partially obscured, but won't work with Direct3D windows:+ 
 +This method is most appropriate for dialogue boxes and other child windows. It will work even if the window is wholly or partially obscured, but won't work with Direct3D windows:
  
 <code bb4w> ​ <code bb4w> ​
Line 33: Line 35:
 </​code>​ </​code>​
  
-where **dlg%** is the value returned from **FN_newdialog**.\\ \\  The procedure calls the **PROCsaveasbmp** routine which is listed below. If you want to capture the window as a JPEG or GIF file change the **PROCsaveasbmp** to [[/​Saving%20a%20JPEG%20image|PROCsavejpeg]] or [[/​Saving%20a%20GIF%20image|PROCsavegif]] respectively.\\ \\ +where **dlg%** is the value returned from **FN_newdialog**.\\ \\  The procedure calls the **PROCsaveasbmp** routine which is listed below. If you want to capture the window as a JPEG or GIF file change the **PROCsaveasbmp** to [[/​Saving%20a%20JPEG%20image|PROCsavejpeg]] or [[/​Saving%20a%20GIF%20image|PROCsavegif]] respectively. 
 ===== Method two ===== ===== Method two =====
-\\  ​This method is appropriate for Direct3D windows and other windows which don't give the required results with the previous method. However if the window is wholly or partially obscured, the captured image will include the obscuring object:+ 
 +This method is appropriate for Direct3D windows and other windows which don't give the required results with the previous method. However if the window is wholly or partially obscured, the captured image will include the obscuring object:
  
 <code bb4w> <code bb4w>
Line 61: Line 65:
 </​code>​ </​code>​
  
-The procedure calls the **PROCsaveasbmp** routine which is listed below. If you want to capture the window as a JPEG or GIF file change the **PROCsaveasbmp** to [[/​Saving%20a%20JPEG%20image|PROCsavejpeg]] or [[/​Saving%20a%20GIF%20image|PROCsavegif]] respectively.\\ \\ +The procedure calls the **PROCsaveasbmp** routine which is listed below. If you want to capture the window as a JPEG or GIF file change the **PROCsaveasbmp** to [[/​Saving%20a%20JPEG%20image|PROCsavejpeg]] or [[/​Saving%20a%20GIF%20image|PROCsavegif]] respectively. 
 ===== Method three ===== ===== Method three =====
-\\  ​This is similar to **Method two**, but simulates capturing the mouse pointer in addition to the window contents:+ 
 +This is similar to **Method two**, but simulates capturing the mouse pointer in addition to the window contents:
  
 <code bb4w> <code bb4w>
Line 135: Line 141:
  
 ===== Saving a bitmap to a file ===== ===== Saving a bitmap to a file =====
-\\  ​This routine can be used whenever you want to save to file a bitmap whose handle you know:+ 
 +This routine can be used whenever you want to save to file a bitmap whose handle you know:
  
 <code bb4w> <code bb4w>
capturing_20the_20contents_20of_20a_20window.txt · Last modified: 2018/04/16 14:41 by richardrussell