elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  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 4,293 veces)
_katze_

Desconectado Desconectado

Mensajes: 140



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

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
  1.  Public Sub New()
  2.            'escritorio = rectangle
  3.            B_rectangle = Windows.Forms.Screen.PrimaryScreen.Bounds
  4.            'encapsulamos mapas de bits a partir del B_rectangle.
  5.            B_image = New Drawing.Bitmap(B_rectangle.Width, B_rectangle.Height, Drawing.Imaging.PixelFormat.Format32bppArgb)
  6.            'crea la imagen a partir de b_image
  7.            B_graphics = Drawing.Graphics.FromImage(B_image)
  8.        End Sub
  9.  
  10.  
  11. Public Function GetSnapshot() As IntPtr Implements Icaptura.GetSnapshot
  12.            If B_bitmapData IsNot Nothing Then
  13.                Throw New InvalidOperationException("Hay que liberar la instantánea actual antes de obtener una nueva.")
  14.            End If
  15.            B_graphics.CopyFromScreen(0, 0, 0, 0, B_rectangle.Size)
  16.            B_bitmapData = B_image.LockBits(B_rectangle, Drawing.Imaging.ImageLockMode.ReadOnly, Drawing.Imaging.PixelFormat.Format32bppArgb)
  17.            Return B_bitmapData.Scan0
  18.  
  19.        End Function
  20.  
Código
  1.  
  2.        Public Sub New(ByRef target As Windows.Forms.Control, ByVal width As Integer, ByVal height As Integer, ByVal pixelformat As Drawing.Imaging.PixelFormat)
  3.            o_target = target
  4.            o_graphics = o_target.CreateGraphics
  5.  
  6.            b_rectangle = New Drawing.Rectangle(0, 0, width, height)
  7.            b_format = pixelformat
  8.  
  9.            Dim stride As Integer
  10.            stride = 0
  11.  
  12.            Select Case b_format
  13.                Case Drawing.Imaging.PixelFormat.Format16bppArgb1555, Drawing.Imaging.PixelFormat.Format16bppRgb555, Drawing.Imaging.PixelFormat.Format16bppRgb565
  14.                    stride = (width * 2)
  15.                Case Drawing.Imaging.PixelFormat.Format24bppRgb
  16.                    stride = (width * 3)
  17.                Case Drawing.Imaging.PixelFormat.Format32bppArgb, Drawing.Imaging.PixelFormat.Format32bppPArgb, Drawing.Imaging.PixelFormat.Format32bppRgb
  18.                    stride = (width * 4)
  19.            End Select
  20.  
  21.            b_length = height * stride
  22.  
  23.            buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length)
  24.  
  25.            b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer)
  26.            o_graphics.DrawImage(b_image, o_target.ClientRectangle)
  27.        End Sub
  28.  
  29.  
  30.        Public Sub DrawUpdate(ByVal intIndex As Integer, ByRef aryData() As Byte, ByVal intIndex_Data As Integer, ByVal intLength As Integer) Implements Idibujar.DrawUpdate
  31.            Runtime.InteropServices.Marshal.Copy(aryData, intIndex_Data, CInt(buffer) + intIndex, intLength)
  32.        End Sub
  33.  
  34.  

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 pm por _katze_ » En línea

[D4N93R]
Wiki

Desconectado Desconectado

Mensajes: 1.646


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 am »

Pero qué es lo que quieres hacer?

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


En línea

_katze_

Desconectado Desconectado

Mensajes: 140



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

la idea es dibujar la captura de pantalla que realizo :S
En línea

[D4N93R]
Wiki

Desconectado Desconectado

Mensajes: 1.646


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 pm »

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

luego:

Código
  1. //buffer en este caso es un pointer a un array de bytes que contengan
  2. //la data de la imagen como tal.
  3. b_length = height * stride
  4. buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length)
  5.  
  6. //la pregunta es: Donde está la data? buffer tiene que apuntar a un array con la imagen
  7. b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer)
  8.  
  9.  
  10. //Acá está bien, pero b_image creo que esta en blanco.
  11. o_graphics.DrawImage(b_image, o_target.ClientRectangle)
  12.  
En línea

_katze_

Desconectado Desconectado

Mensajes: 140



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

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

_katze_

Desconectado Desconectado

Mensajes: 140



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

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

Código
  1.  
  2.        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)
  3.            o_target = target
  4.            o_graphics = o_target.CreateGraphics
  5.  
  6.            b_rectangle = New Drawing.Rectangle(0, 0, width, height)
  7.            b_format = pixelformat
  8.            Dim stride As Integer
  9.            stride = 0
  10.  
  11.            Select Case b_format
  12.                Case Drawing.Imaging.PixelFormat.Format16bppArgb1555, Drawing.Imaging.PixelFormat.Format16bppRgb555, Drawing.Imaging.PixelFormat.Format16bppRgb565
  13.                    stride = (width * 2)
  14.                Case Drawing.Imaging.PixelFormat.Format24bppRgb
  15.                    stride = (width * 3)
  16.                Case Drawing.Imaging.PixelFormat.Format32bppArgb, Drawing.Imaging.PixelFormat.Format32bppPArgb, Drawing.Imaging.PixelFormat.Format32bppRgb
  17.                    stride = (width * 4)
  18.            End Select
  19.  
  20.            b_length = height * stride
  21.  
  22.            buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length)
  23.  
  24.            b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer)
  25.            o_graphics.DrawImage(b_image, o_target.ClientRectangle)
  26.        End Sub
  27.  
  28.  
  29.        Public Sub DrawUpdate(ByVal intIndex As Integer, ByRef aryData() As Byte, ByVal intIndex_Data As Integer, ByVal intLength As Integer) Implements Idibujar.DrawUpdate
  30.            Runtime.InteropServices.Marshal.Copy(aryData, intIndex_Data, CInt(buffer) + intIndex, intLength)
  31.        End Sub
  32.  
  33.  
  34.  
En línea

_katze_

Desconectado Desconectado

Mensajes: 140



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

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.621



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

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

_katze_

Desconectado Desconectado

Mensajes: 140



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

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 »
Programación Visual Basic
kakinets 15 5,800 Último mensaje 6 Octubre 2005, 22:32 pm
por NYlOn
Ayuda Captura de Pantalla!!!!!
Programación Visual Basic
Badlands 3 1,735 Último mensaje 29 Agosto 2006, 02:49 am
por maxnet
Ayuda con la captura de pantalla, POR FAVOR!!!!
Programación Visual Basic
Flamareoon2000 3 1,442 Último mensaje 8 Noviembre 2006, 00:12 am
por ranslsad
Captura de Pantalla
.NET (C#, VB.NET, ASP)
David Vans 2 2,830 Último mensaje 24 Mayo 2008, 14:10 pm
por David Vans
Como agrandar una captura de pantalla sin pixelarla?
Windows
DonPilin 3 3,392 Último mensaje 13 Abril 2022, 17:25 pm
por el-brujo
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines