Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Software: Visual Basic 2008
My problem:
I make a program for taking screenshots from the game, this is the current code that I use:
 
Dim bounds As Rectangle
            Dim screenshot As System.Drawing.Bitmap
            Dim graph As Graphics
            bounds = Screen.PrimaryScreen.Bounds
            screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
            graph = Graphics.FromImage(screenshot)
            graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
            PictureBox1.Image = screenshot
 
and it works great when i need to take a desktop screenshot, but when i try take a game screenshot it does not work! I read on the internet and it says that I need to take screenshots from DirectX. The problem is that I never worked with DirectX and I need your help, any help is welcome if it is related to my problem, I would appreciate if you have some kind of example.
 

 

 
Thank you!
Posted 2-Feb-12 23:52pm
Budo007282
Comments
SAKryukov at 3-Feb-12 4:56am
   
Of course! It would not be shown. Pretty interesting question.
--SA
SAKryukov at 3-Feb-12 4:57am
   
VB or VB.NET?
--SA
Budo007 at 3-Feb-12 5:35am
   
visual basic - vb

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This is how it is done in c# for directx 9, 10 and 11:
http://spazzarama.wordpress.com/2011/03/14/c-screen-capture-and-overlays-for-direct3d-9-10-and-11-using-api-hooks/[^]
 
Here an article that also has a vb.net example:
Capture Sample with DirectX and .NET[^]
 
Good luck!
  Permalink  
v2
Comments
Espen Harlinn at 9-Feb-12 9:09am
   
5'ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,800
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 6 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100