Capturar imagen
Publicado por ricardo (3 intervenciones) el 02/01/2006 16:58:02
Hola a todos lo que yo necesito es Capturar la pantalla activa y la guardarla en formato BMP
Encontre este codigo pero al parecer le falta algo o algo esta mal
'Captura la pantalla activa y la guarda en formato BMP
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Function fSaveGuiToFile(ByVal theFile As String) As Boolean
' Name: fSaveGuiToFile
' Author: Dalin Nie
' Written: 4/2/99
' Purpose:
' This procedure will Capture the Screen or the active window of your Computer and Save it as
' a .bmp file
' Input:
' theFile file Name with path, where you want the .bmp to be saved
'
' Output:
' True if successful
'
Dim lString As String
On Error goto Trap
'Check if the File Exist
If Dir(theFile) <> "" Then Exit Function
'To get the Entire Screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)
'To get the Active Window
'Call keybd_event(vbKeySnapshot, 0, 0, 0)
SavePicture Clipboard.GetData(vbCFBitmap), theFile
fSaveGuiToFile = True
Exit Function
Trap:
'Error handling
MsgBox "Error Occured in fSaveGuiToFile. Error #: " & Err.Number & ", " & Err.Description
End Function
Encontre este codigo pero al parecer le falta algo o algo esta mal
'Captura la pantalla activa y la guarda en formato BMP
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Function fSaveGuiToFile(ByVal theFile As String) As Boolean
' Name: fSaveGuiToFile
' Author: Dalin Nie
' Written: 4/2/99
' Purpose:
' This procedure will Capture the Screen or the active window of your Computer and Save it as
' a .bmp file
' Input:
' theFile file Name with path, where you want the .bmp to be saved
'
' Output:
' True if successful
'
Dim lString As String
On Error goto Trap
'Check if the File Exist
If Dir(theFile) <> "" Then Exit Function
'To get the Entire Screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)
'To get the Active Window
'Call keybd_event(vbKeySnapshot, 0, 0, 0)
SavePicture Clipboard.GetData(vbCFBitmap), theFile
fSaveGuiToFile = True
Exit Function
Trap:
'Error handling
MsgBox "Error Occured in fSaveGuiToFile. Error #: " & Err.Number & ", " & Err.Description
End Function
Valora esta pregunta
0