Taking a screen shot of a game (Counter-Strike 1.6)
Hello guys. I am trying to take a screen shot while I am ingame (counter-strike). When I try to take a screenshot it gives me a black picture. It happens only when I am in-game (when I am in desktop and take a screenshot, it works). Someone told me that this game uses OpenGL and maybe that is the problem. This is the code I use:
Code:
private Image CaptureScreen()
{
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
Bitmap target = new Bitmap(screenSize.Width, screenSize.Height);
using (Graphics g = Graphics.FromImage(target))
{
g.CopyFromScreen(0, 0, 0, 0, new Size(screenSize.Width, screenSize.Height));
}
return target;
}
thanks in advance.
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Search bing or google for "taking a screenshot of open gl".
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Thanks. I already searched and found many articles but none of them worked, it givea me a black screen with white empty square on the left corner of the screen shot image.
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Maybe counterstrike is hooking the open gl call and preventing you from taking the screen shot?
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Yes that makes sense. I found an article says that the only way to do it is to use the injection method. Can you help me find something about it? I have searched and nothing comes up
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Quote:
Originally Posted by
Ornakash
Yes that makes sense. I found an article says that the only way to do it is to use the injection method. Can you help me find something about it? I have searched and nothing comes up
My point is that the game is hooking to prevent you from screen capturing. It is unlikely you'll be able to undo what they are doing with your own hook. Try searching bing or google for "how to hook a process." There's lots of info out there.
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Quote:
Originally Posted by
Arjay
My point is that the game is hooking to prevent you from screen capturing. It is unlikely you'll be able to undo what they are doing with your own hook. Try searching bing or google for "how to hook a process." There's lots of info out there.
I couldn't find a way to do this using C#. Some people say that it's not possible to hook a process in C#. Is it the only way to do it? I know C# better than CPP.
Source: https://support.microsoft.com/he-il/...n-visual-c-net
Re: Taking a screen shot of a game (Counter-Strike 1.6)
Quote:
Originally Posted by
Ornakash
The article you are linking to shows you how to hook a process in c#. Not sure why you are questioning whether it can be done when you have an article that shows you how to do it.