elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
28 Mayo 2012, 04:28  


Tema destacado: [AIO elhacker.NET] Compilación herramientas análisis y desinfección malware

+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (Moderador: [D4N93R])
| | | |-+  ayuda con captura de pantalla
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: ayuda con captura de pantalla  (Leído 933 veces)
_katze_

Desconectado Desconectado

Mensajes: 99



Ver Perfil WWW
ayuda con captura de pantalla
« en: 21 Enero 2011, 23:20 »

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
Código
  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
 
Código
 
       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]
Moderador
***
Desconectado Desconectado

Mensajes: 1.647


My software never has bugs. Its just features!


Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #1 en: 22 Enero 2011, 01:39 »

Pero qué es lo que quieres hacer?

Porque según veo estás dibujando NADA. :S


En línea

_katze_

Desconectado Desconectado

Mensajes: 99



Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #2 en: 22 Enero 2011, 01:48 »

la idea es dibujar la captura de pantalla que realizo :S
En línea
[D4N93R]
Moderador
***
Desconectado Desconectado

Mensajes: 1.647


My software never has bugs. Its just features!


Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #3 en: 22 Enero 2011, 14:40 »

Pero la estas sacando de otro control verdad? es decir de:  o_graphics = o_target.CreateGraphics

luego:

Código
//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_

Desconectado Desconectado

Mensajes: 99



Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #4 en: 22 Enero 2011, 19:59 »

tenes razon b_image esta vacio,tengo q rellenar el espacioo q queda o algo asi
En línea
_katze_

Desconectado Desconectado

Mensajes: 99



Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #5 en: 25 Enero 2011, 16:07 »

modifique la primera linea de codigo,,sera logico asi ¿?

Código
 
       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_

Desconectado Desconectado

Mensajes: 99



Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #6 en: 27 Enero 2011, 00:36 »

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  :P
En línea
seba123neo


Desconectado Desconectado

Mensajes: 3.214



Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #7 en: 27 Enero 2011, 03:28 »

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_

Desconectado Desconectado

Mensajes: 99



Ver Perfil WWW
Re: ayuda con captura de pantalla
« Respuesta #8 en: 27 Enero 2011, 18:40 »

si seba estoy viendo eso y estoy poniendome al dia para empesarlo...si tienes algo de teoria estaria bien.gracias
En línea
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Captura de pantalla « 1 2 »
Software
g-unit 20 1,262 Último mensaje 7 Junio 2005, 23:18
por © Shadoweps ツ
Ayuda Captura de Pantalla!!!!!
Programación Visual Basic
Badlands 3 340 Último mensaje 29 Agosto 2006, 02:49
por maxnet
Ayuda con la captura de pantalla, POR FAVOR!!!!
Programación Visual Basic
Flamareoon2000 3 383 Último mensaje 8 Noviembre 2006, 00:12
por ranslsad
Captura de Pantalla
.NET
David Vans 2 941 Último mensaje 24 Mayo 2008, 14:10
por David Vans
Captura de pantalla
Programación General
rikidel 1 642 Último mensaje 30 Septiembre 2008, 21:44
por el-viejo
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines