Como Puedo Capturar Una Imagen En Visual Basic

Quiero Capturar Una Pantalla En Visual Basic De Un Equipo Remoto Y Traerla A Mi Equipo Por Winsock y guardala en un archivo
ah tambien tengo otro problema no puedo abrir bases de datos en formato access 2000 en vb6 porque alguien que me ayude
mi mail es [email protected]
Respuesta
1
Para capturar una pantalla en un equipo remoto tendras que crear un ejecutable que este ejecutandose en segundo plano con un winsock que este escuchando y que ejecute el codigo siguiente cuando reciba la orden de capturar:
Private Type PALETTEENTRY
PeRed As Byte
PeGreen As Byte
PeBlue As Byte
PeFlags As Byte
End Type
Private Type LOGPALETTE
palVersion As Integer
palNumEntries As Integer
palPalEntry(255) As PALETTEENTRY ' Enough for 256 colors.
End Type
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Type PicBmp
Size As Long
Type As Long
hBmp As Long
hPal As Long
Reserved As Long
End Type
Private Declare Function GetDC Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function DeleteDC Lib "GDI32" _
(ByVal hDC As Long) As Long
Private Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, ByVal hDC As Long) As Long
Private Declare Function CreateCompatibleDC Lib "GDI32" _
(ByVal hDC As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "GDI32" _
(ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "GDI32" _
(ByVal hDC As Long, ByVal hObject As Long) As Long
Private Declare Function GetDeviceCaps Lib "GDI32" _
(ByVal hDC As Long, ByVal iCapabilitiy As Long) As Long
Private Declare Function GetSystemPaletteEntries Lib "GDI32" _
(ByVal hDC As Long, ByVal wStartIndex As Long, ByVal wNumEntries As Long, lpPaletteEntries As PALETTEENTRY) As Long
Private Declare Function CreatePalette Lib "GDI32" _
(lpLogPalette As LOGPALETTE) As Long
Private Declare Function SelectPalette Lib "GDI32" _
(ByVal hDC As Long, ByVal hPalette As Long, ByVal bForceBackground As Long) As Long
Private Declare Function RealizePalette Lib "GDI32" _
(ByVal hDC As Long) As Long
Private Declare Function BitBlt Lib "GDI32" _
(ByVal hDCDest As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal hDCSrc As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal dwRop As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" _
(PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
Function CaptureWindow(ByVal hWndSrc As Long, _
ByVal LeftSrc As Long, ByVal TopSrc As Long, _
ByVal WidthSrc As Long, ByVal HeightSrc As Long) As Picture
Dim hDCMemory As Long
Dim hBmp As Long
Dim hBmpPrev As Long
Dim r As Long
Dim hDCSrc As Long
Dim hPal As Long
Dim hPalPrev As Long
Dim RasterCapsScrn As Long
Dim HasPaletteScrn As Long
Dim PaletteSizeScrn As Long
Dim LogPal As LOGPALETTE
Const RASTERCAPS As Long = 38
Const RC_PALETTE As Long = &H100
Const SIZEPALETTE As Long = 104
' Get device context for client area.
hDCSrc = GetDC(hWndSrc)
' Create a memory device context for the copy process.
hDCMemory = CreateCompatibleDC(hDCSrc)
' Create a bitmap and place it in the memory DC.
hBmp = CreateCompatibleBitmap(hDCSrc, WidthSrc, HeightSrc)
hBmpPrev = SelectObject(hDCMemory, hBmp)
' Get screen properties.
RasterCapsScrn = GetDeviceCaps(hDCSrc, RASTERCAPS) ' Raster capabilities.
HasPaletteScrn = RasterCapsScrn And RC_PALETTE ' Palette support.
PaletteSizeScrn = GetDeviceCaps(hDCSrc, SIZEPALETTE) ' Size of palette.
' If the screen has a palette make a copy and realize it.
If HasPaletteScrn And (PaletteSizeScrn = 256) Then
' Create a copy of the system palette.
LogPal.palVersion = &H300
LogPal.palNumEntries = 256
r = GetSystemPaletteEntries(hDCSrc, 0, 256, _
LogPal.palPalEntry(0))
hPal = Create

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas