Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
4.00/5 (1 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:

VB
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
Comments
Sergey Alexandrovich Kryukov 3-Feb-12 4:56am    
Of course! It would not be shown. Pretty interesting question.
--SA
Sergey Alexandrovich Kryukov 3-Feb-12 4:57am    
VB or VB.NET?
--SA
Budo007 3-Feb-12 5:35am    
visual basic - vb

1 solution

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!
 
Share this answer
 
v2
Comments
Espen Harlinn 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900