PDA

Click to See Complete Forum and Search --> : Graphics Help


winapi
Mar 10th, 2000, 08:19 AM
Hi,
I'm developing a program for work that need to capture the current screen and save it as some sort of graphic file (like a screen capture). I think there should be some kind of api routine that will do the trick, but I'm not sure. Please Help
Thanks
Richard Lange
rlange-csa@home.com

Mar 10th, 2000, 09:23 AM
Hi, I took this code from one example from this site but add the save feature.


Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private 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 Form_Load()
Dim A As Long
Dim s As Long
Form1.AutoRedraw = True
Form1.ScaleMode = 1
A = GetDesktopWindow()
s = GetDC(A)
BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, s, 0, 0, vbSrcCopy
SavePicture Me.Image, "image.bmp"

End Sub



Kayan.

aykurt
Mar 12th, 2000, 09:00 PM
Hi

what if a want to save and send a form as a bmp file to a mail receptionist. I can start up my outlook express and want to send a form with e-mail.


Hi, I took this code from one example from this site but add the save feature.


Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private 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 Form_Load()
Dim A As Long
Dim s As Long
Form1.AutoRedraw = True
Form1.ScaleMode = 1
A = GetDesktopWindow()
s = GetDC(A)
BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, s, 0, 0, vbSrcCopy
SavePicture Me.Image, "image.bmp"

End Sub



Kayan.