Search Tools Links Login

Capture Desktop Picture


Capture Desktop Picture (*.jpg")

Original Author: Mohammad Amin Mansouri

Code

'//Capture Desktop
'Programmer : Mohammad Amin Mansouri :p
'forum : Wwww.Forum.Honarjo.com
'WebSite : Www.AhoraChat.Net & Www.Iridiver.Net
'Phone: +989390763223
'Email : SetareSokhte@Gmail.com
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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 123 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.