Tema destacado: [AIO elhacker.NET] Compilación herramientas análisis y desinfección malware
Autor
|
Tema: ayuda con captura de pantalla (Leído 933 veces)
|
|
_katze_
|
tengo el fragmento de este code el cual toma una captura de la pantalla y todo bien lo toma sin problemas, el problema es el siguiente Public Sub New() 'escritorio = rectangle B_rectangle = Windows.Forms.Screen.PrimaryScreen.Bounds 'encapsulamos mapas de bits a partir del B_rectangle. B_image = New Drawing.Bitmap(B_rectangle.Width, B_rectangle.Height, Drawing.Imaging.PixelFormat.Format32bppArgb) 'crea la imagen a partir de b_image B_graphics = Drawing.Graphics.FromImage(B_image) End Sub Public Function GetSnapshot() As IntPtr Implements Icaptura.GetSnapshot If B_bitmapData IsNot Nothing Then Throw New InvalidOperationException("Hay que liberar la instantánea actual antes de obtener una nueva.") End If B_graphics.CopyFromScreen(0, 0, 0, 0, B_rectangle.Size) B_bitmapData = B_image.LockBits(B_rectangle, Drawing.Imaging.ImageLockMode.ReadOnly, Drawing.Imaging.PixelFormat.Format32bppArgb) Return B_bitmapData.Scan0 End Function Public Sub New(ByRef target As Windows.Forms.Control, ByVal width As Integer, ByVal height As Integer, ByVal pixelformat As Drawing.Imaging.PixelFormat) o_target = target o_graphics = o_target.CreateGraphics b_rectangle = New Drawing.Rectangle(0, 0, width, height) b_format = pixelformat Dim stride As Integer stride = 0 Select Case b_format Case Drawing.Imaging.PixelFormat.Format16bppArgb1555, Drawing.Imaging.PixelFormat.Format16bppRgb555, Drawing.Imaging.PixelFormat.Format16bppRgb565 stride = (width * 2) Case Drawing.Imaging.PixelFormat.Format24bppRgb stride = (width * 3) Case Drawing.Imaging.PixelFormat.Format32bppArgb, Drawing.Imaging.PixelFormat.Format32bppPArgb, Drawing.Imaging.PixelFormat.Format32bppRgb stride = (width * 4) End Select b_length = height * stride buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length) b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer) o_graphics.DrawImage(b_image, o_target.ClientRectangle) End Sub Public Sub DrawUpdate(ByVal intIndex As Integer, ByRef aryData() As Byte, ByVal intIndex_Data As Integer, ByVal intLength As Integer) Implements Idibujar.DrawUpdate Runtime.InteropServices.Marshal.Copy(aryData, intIndex_Data, CInt(buffer) + intIndex, intLength) End Sub esta segunda part es fragmento de un code el cual no logro hacer que dibuje donde le designo.... o si hay alguna otra forma me seria de utilidad, y si desean las declaraciones de las variables las subo o algo mas.
|
|
|
|
« Última modificación: 21 Enero 2011, 23:26 por _katze_ »
|
En línea
|
|
|
|
|
[D4N93R]
|
Pero qué es lo que quieres hacer?
Porque según veo estás dibujando NADA. :S
|
|
|
|
|
En línea
|
|
|
|
|
_katze_
|
la idea es dibujar la captura de pantalla que realizo :S
|
|
|
|
|
En línea
|
|
|
|
|
[D4N93R]
|
Pero la estas sacando de otro control verdad? es decir de: o_graphics = o_target.CreateGraphics luego: //buffer en este caso es un pointer a un array de bytes que contengan //la data de la imagen como tal. b_length = height * stride buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length) //la pregunta es: Donde está la data? buffer tiene que apuntar a un array con la imagen b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer) //Acá está bien, pero b_image creo que esta en blanco. o_graphics.DrawImage(b_image, o_target.ClientRectangle)
|
|
|
|
|
En línea
|
|
|
|
|
_katze_
|
tenes razon b_image esta vacio,tengo q rellenar el espacioo q queda o algo asi
|
|
|
|
|
En línea
|
|
|
|
|
_katze_
|
modifique la primera linea de codigo,,sera logico asi ¿? Public Sub New(ByRef target As Windows.Forms.Control, ByVal width As Integer, ByVal height As Integer, ByVal pixelformat As Drawing.Imaging.PixelFormat,ByVal Buffer as intPtr) o_target = target o_graphics = o_target.CreateGraphics b_rectangle = New Drawing.Rectangle(0, 0, width, height) b_format = pixelformat Dim stride As Integer stride = 0 Select Case b_format Case Drawing.Imaging.PixelFormat.Format16bppArgb1555, Drawing.Imaging.PixelFormat.Format16bppRgb555, Drawing.Imaging.PixelFormat.Format16bppRgb565 stride = (width * 2) Case Drawing.Imaging.PixelFormat.Format24bppRgb stride = (width * 3) Case Drawing.Imaging.PixelFormat.Format32bppArgb, Drawing.Imaging.PixelFormat.Format32bppPArgb, Drawing.Imaging.PixelFormat.Format32bppRgb stride = (width * 4) End Select b_length = height * stride buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length) b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer) o_graphics.DrawImage(b_image, o_target.ClientRectangle) End Sub Public Sub DrawUpdate(ByVal intIndex As Integer, ByRef aryData() As Byte, ByVal intIndex_Data As Integer, ByVal intLength As Integer) Implements Idibujar.DrawUpdate Runtime.InteropServices.Marshal.Copy(aryData, intIndex_Data, CInt(buffer) + intIndex, intLength) End Sub
|
|
|
|
|
En línea
|
|
|
|
|
_katze_
|
ya tengo los modulos funcionando y por modificar un par de cosas...ahora podre comensar el escritorio remoto...si tienen ideas o algo en mente me dicen 
|
|
|
|
|
En línea
|
|
|
|
|
seba123neo
|
no te quiero desanimar, pero mira que el escritorio remoto es un poquito mas dificil que capturar la pantalla, no es solo capturar la pantalla a cada rato y listo, debes mandar por partes las imagenes y solo las que realmente cambiaron, tiene todo una logica esto, pero bueno adelante con tu proyecto !!!
saludos.
|
|
|
|
|
En línea
|
Mucha gente, especialmente la ignorante desea castigarte por decir la verdad, por ser correcto, por ser tú. Nunca te disculpes por ser correcto, o por estar años delante de tu tiempo. Si estas en lo cierto, y lo sabes, que hable tu razón. Incluso si eres una minoria de uno solo, la verdad sigue siendo la verdad. M. Gandhi
|
|
|
|
_katze_
|
si seba estoy viendo eso y estoy poniendome al dia para empesarlo...si tienes algo de teoria estaria bien.gracias
|
|
|
|
|
En línea
|
|
|
|
|
|