Progamación en Visual Basic

Iniciado por JSP-O, 16 Febrero 2013, 22:15 PM

0 Miembros y 1 Visitante están viendo este tema.

JSP-O

Hola, tengo una pregunta sobre visual basic 2005, talvez me pueden ayudar.
quiero hacer un programa que tome fotos de lo que sucede hen la pantalla, pero no me se ningun codigo, ¿que codigo puedo poner?,talvez me ayudan

Danyfirex

este codigo es para vb6.
estudialo.

Código (vb) [Seleccionar]
'Screen Capture Demo by Tanner Helland (published 2008, updated 2012)
' http://www.tannerhelland.com

'If you like VB game and graphics code, be sure to subscribe to my RSS feed at
' http://www.tannerhelland.com/feed/

'The required API calls are:

'This call gives us the hWnd (window handle) of the screen
Private Declare Function GetDesktopWindow Lib "user32" () As Long

'This call assigns an hDC (handle of device context) from an hWnd
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long

'BitBlt lets us draw an image from a hDC to another hDC (in our case, from an hDC of the screen capture
' to the hDC of a VB picture box)
Private Declare Function BitBlt Lib "gdi32" (ByVal hDC 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 opCode As Long) As Long

'ReleaseDC will be used to release the screen's hDC once the screen capture is complete.
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long

'This sample project copies the screen when the form loads; you could also place this code in
' a command button (or any other input)
Private Sub Form_Load()

    'First, minimize this window
    Me.WindowState = vbMinimized
   
    'Get the hWnd of the screen
    Dim scrHwnd As Long
    scrHwnd = GetDesktopWindow
   
    'Now, assign an hDC to the hWnd we generated
    Dim shDC As Long
    shDC = GetDC(scrHwnd)
   
    'Determine the size of the screen
    Dim screenWidth As Long, screenHeight As Long
    screenWidth = Screen.Width \ Screen.TwipsPerPixelX
    screenHeight = Screen.Height \ Screen.TwipsPerPixelY
   
    'Copy the data from the screen hDC to this VB form
    BitBlt FormScreenCapture.hDC, 0, 0, screenWidth, screenHeight, shDC, 0, 0, vbSrcCopy

    'Release our hold on the screen's hDC
    ReleaseDC scrHwnd, shDC
   
    'Set the picture of the form to equal its image
    FormScreenCapture.Picture = FormScreenCapture.Image
   
    'Restore the window
    Me.WindowState = vbNormal

End Sub



ya deja de usar vb 5 es algo viejo  :rolleyes: lo es el 6.