Visual Basic para Aplicaciones - Print Pantalla

Life is soft - evento anual de software empresarial
 
Vista:

Print Pantalla

Publicado por maria (3 intervenciones) el 18/08/2004 13:04:30
Me gustaría hacer un programa en visual basic que cuando lo ejecutes se realice un print, una foto, de la pantalla del ordenador en ese momento. No se que componentes debo agregar, ni que componentes.
Alguien puede ayudarme un poco o darme alguna orientacion?
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

RE:Print Pantalla

Publicado por Cristian (27 intervenciones) el 18/08/2004 16:09:01
Hola

Para lo siguiente coloca un formulario y cambia su propiedad AutoRedraw=True y coloca el siguiente codigo


Option Explicit

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
Private Declare Function StretchBlt 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 wSrc As Long, ByVal hSrc As Long, ByVal dwRop As Long) As Long
Const SRCCOPY = &HCC0020

Sub Capture(Frm As Form)
Dim rc As Long, Height As Long, Width As Long, dtHDC As Long
Dim Pic As New StdPicture


Width = Screen.Width / Screen.TwipsPerPixelX
Height = Screen.Height / Screen.TwipsPerPixelY
dtHDC = GetDC(GetDesktopWindow())
rc = BitBlt(GetDC(Pic.Handle), 0, 0, Width, Height, dtHDC, 0, 0, SRCCOPY)
rc = StretchBlt(Frm.hDC, 0, 0, Width, Height, GetDC(Pic.Handle), 0, 0, Width, Height, SRCCOPY)
End Sub
Private Sub Form_Load()
Capture Me
App.TaskVisible = False
End Sub


Lo anterior toma una foto de la pantalla y la coloca en tu formulario

Esto lo probe y funciono
Saludos
www.theemulator.tk
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

RE:Print Pantalla

Publicado por maria (3 intervenciones) el 18/08/2004 16:33:35
GRACIAS Cristias, Funciona perfectamente, pero lo que quiero es guardar esa imagen como un archivo. Es decir programaré el ejecutable del programa para que se ejecute a ciertas horas y los que quiero es que guarde las fotos de todas las veces que se ejecute.
Se te ocurre como se puede hacer?
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

RE:Print Pantalla

Publicado por Cristian (27 intervenciones) el 19/08/2004 00:58:13
Hola
Si necesitas guardar la imagen puedes usar esto

SavePicture Me.Picture, "C:\Dibujo.bmp"

Saludos
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