Access - Capturar imagen

 
Vista:

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
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alejandro

Capturar la pantalla activa y guardarla en formato BMP

Publicado por Alejandro (4142 intervenciones) el 15/06/2023 21:51:07
Aquí tienes una posible solución para capturar la pantalla activa y guardarla en formato BMP utilizando el código que proporcionaste:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
    On Error GoTo Trap
 
    ' Comprobar si el archivo ya existe
    If Dir(theFile) <> "" Then Exit Function
 
    ' Capturar la pantalla activa
    Call keybd_event(vbKeySnapshot, 1, 0, 0)
 
    ' Guardar la imagen en el archivo especificado
    SavePicture Clipboard.GetData(vbCFBitmap), theFile
 
    fSaveGuiToFile = True
    Exit Function
 
Trap:
    ' Manejo de errores
    MsgBox "Se produjo un error en fSaveGuiToFile. Número de error: " & Err.Number & ", Descripción del error: " & Err.Description
End Function

Puedes llamar a la función `fSaveGuiToFile` y pasarle como argumento la ruta y el nombre de archivo donde deseas guardar la captura de pantalla en formato BMP. Por ejemplo:

1
fSaveGuiToFile "C:\Ruta\Archivo.bmp"

Recuerda que necesitarás los permisos adecuados para guardar el archivo en la ubicación especificada.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar