VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Capture Desktop Picture

by Mohammad Amin Mansouri (1 Submission)
Category: Windows API Call/Explanation
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

Capture Desktop Picture (*.jpg")

Rate Capture Desktop Picture

'//Capture Desktop
'Programmer : Mohammad Amin Mansouri :p
'forum : Wwww.Forum.Honarjo.com
'WebSite : Www.AhoraChat.Net & Www.Iridiver.Net
'Phone: +989390763223
'Email : [email protected]
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
Dim Img As ImageFile
Dim IP As ImageProcess
Dim Pic As ImageFile
Private Sub Form_Load()
Call CaptureDesktop("c:\amin.jpg")
End Sub
Public Function CaptureDesktop(Path As String) As String
Set Img = New ImageFile
Set IP = New ImageProcess
IP.Filters.Add IP.FilterInfos("Convert").FilterID
IP.Filters(1).Properties(1).Value = wiaFormatJPEG
Form1.AutoRedraw = True
Form1.ScaleMode = vbpixel
Amin = GetDesktopWindow()
Persian = GetDC(Amin)
BitBlt Form1.hDC, 0, 0, Form1.Width, Form1.Height, Persian, 0, 0, vbSrcCopy
SavePicture Form1.Image, ("c:\Persian.bmp")
Img.LoadFile ("c:\Persian.bmp")
Set Pic = IP.Apply(Img)
Pic.SaveFile (Path)
Kill ("c:\persian.bmp")
End Function

Download this snippet    Add to My Saved Code

Capture Desktop Picture Comments

No comments have been posted about Capture Desktop Picture. Why not be the first to post a comment about Capture Desktop Picture.

Post your comment

Subject:
Message:
0/1000 characters