Click here to Skip to main content
13,043,865 members (47,889 online)
Rate this:
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 22:52pm
SAKryukov 3-Feb-12 4:56am
Of course! It would not be shown. Pretty interesting question.
SAKryukov 3-Feb-12 4:57am
Budo007 3-Feb-12 5:35am
visual basic - vb

1 solution

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

Solution 1

This is how it is done in c# for directx 9, 10 and 11:[^]

Here an article that also has a example:
Capture Sample with DirectX and .NET[^]

Good luck!
Espen Harlinn 9-Feb-12 9:09am

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 6 Feb 2012
Copyright © CodeProject, 1999-2017
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