Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Screen Capture

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
waynehell Posted - Oct 19 2005 : 1:09:16 PM
Help.!! Please. How can i capture a screen in a directx application and send it to the clipboard??
3   L A T E S T    R E P L I E S    (Newest First)
EX3 Posted - Oct 19 2005 : 10:58:35 PM
quote:
Originally posted by EX3

'Creamos la superficie donde almacenaremos la captura:
    Surf = SURF_Create(D3DWindow.BackBufferWidth, D3DWindow.BackBufferHeight)  


Sorry, the SURF_Create() is an own function of my project, it's used the D3DDevice.CreateImageSurface() function to create the new surface. You are going to have to adapt a bit the code for your objetive.

Chao...
EX3 Posted - Oct 19 2005 : 10:45:36 PM
Hi from Spain. This is possible that this you is useful. This code, in full screen mode, capture the backbuffer and save in to a surface. In windowed mode capture only the client area of the window, without title bar and borders. Before, you can save this surface in to a BMP file with D3DX.SaveSurfaceToFile(). This code run under VB 6.0 and DirectX8, theoretically also it's compatible with DirectX9:
'This code is a part of the dx_lib32 2.0: (sorry, the coments are in spanish)
'-----------------------------------------------------------------------
  
'Realiza una captura de pantalla y la guarda en memoria:
Public Function SURF_ScreenCapture() As Long
On Error GoTo ErrOut  
  
Dim oSurface As Direct3DSurface8  
Dim Pal As PALETTEENTRY  
Dim SrcRect As RECT  
Dim DispMode As D3DDISPLAYMODE  
Dim ClientRect As POINTAPI  
  
Dim Surf As Long
  
If D3D_Init Then
    'Creamos la superficie donde almacenaremos la captura:  
    Surf = SURF_Create(D3DWindow.BackBufferWidth, D3DWindow.BackBufferHeight)  
  
    If Surf < 0 Then GoTo ErrOut '// Replace with a Error.Raise() function for example ;) //  
  
    If Not Windowed Then 'FullScreen:  
  
        'Leemos el contenido de la pantalla (FrontBuffer) y lo guardamos en la superficie:  
        D3DDevice.GetFrontBuffer Surface(Surf).Surface  
  
    Else 'Windowed:  
        'Obtenemos las dimensiones de la resolucion de pantalla del adaptador:  
        D3DDevice.GetDisplayMode DispMode  
  
        'Creamos una superficie con la resolucion seleccionada del adaptador grafico a  
        '32 Bit de color por que la funcion siempre devuelve el resultado a 32 Bits (D3DFMT_A8R8G8B8):  
        Set oSurface = D3DDevice.CreateImageSurface(DispMode.Width, _  
                DispMode.Height, _  
                D3DFMT_A8R8G8B8)  
  
        'Leemos el contenido de la pantalla (FrontBuffer) y lo guardamos en la superficie:  
        D3DDevice.GetFrontBuffer oSurface  
  
        'En modo ventana la captura es de toda la pantalla, escritorio incluido, asi que calculamos  
        'la posicion y las dimensiones del area de cliente de la ventana donde dibujamos para salvar  
        'unicamente el contenido del programa:  
  
        Call GetClientRect(Me.hwnd, SrcRect)  
        Call ClientToScreen(Me.hwnd, ClientRect)  
  
        With SrcRect  
            .Left = ClientRect.X  
            .Right = .Left + .Right  
            .Top = ClientRect.Y  
            .bottom = .Top + .bottom  
        End With
  
        'Copiamos la seccion de captura del programa a la superficie en memoria:  
        Call D3DX.LoadSurfaceFromSurface(Surface(Surf).Surface, Pal, ByVal 0, oSurface, Pal, SrcRect, D3DX_DEFAULT, 0)  
  
    End If
  
    SURF_ScreenCapture = Surf  
  
End If
Exit Function
  
ErrOut:  
SURF_ScreenCapture = -1  
End Function


I hope that it you is useful ;)

Chao...
Eric Coleman Posted - Oct 19 2005 : 2:15:55 PM
Which version of VB are you using and which version of DirectX?

VBGamer © Go To Top Of Page
This page was generated in 0.14 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.