The Capture window is a small application to capture the active window of your application. This program is something I wrote for one of my applications. But by the time I finished it, I thought it might be pretty useful for developers. It can be used to capture the working of the programs.
This project is not complete, it is a work-in-progress. There are numerous issues with the current version which need to be addressed. My long term goal is to develop this to "commercial quality".
I am going to continue to improve this application towards my goal. I will continue to post updates as I feel necessary.
Capture Window is a little program that I wrote when I was having to save win screen during the development of my application Tetris. This program gives a facility to save the window having score with name and quote as a BMP.
Just run the app. You'll see a screen as shown above. This lets you add your name and quote. Now just click on Save ScreenShot Button. This will generate a BMP file named as "Active Window.BMP".
This article is useful to those of my fellow programmers who are tired of trying to capture the active window to BMP.
Basically we use
BitBlt() to get the current window. This usually works better than
SetPixel(). Using this function, we copy active window to
Picturebox. Now we use
SavePicture to save the active window as BMP.
Using the Code
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, _
ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub cmdScreenShot_Click()
frmCanvas.PicSaveScreen.Height = Me.ScaleHeight + 60
frmCanvas.PicSaveScreen.Width = Me.ScaleWidth + 60
BitBlt frmCanvas.PicSaveScreen.hDC, 0, 0, _
Me.ScaleWidth, Me.ScaleHeight, Me.hDC, 0, 0, vbSrcCopy
SavePicture frmCanvas.PicSaveScreen.Image, App.Path & "\Active Window.BMP"
- 12-Aug-2005 - Initial release of article