Can't get screen pixel from a specific full screen game with any language?
Posted
by
user1007059
on Stack Overflow
See other posts from Stack Overflow
or by user1007059
Published on 2012-06-24T15:11:50Z
Indexed on
2012/06/24
15:15 UTC
Read the original article
Hit count: 220
Okay, I know this might seem like I'm posting a duplicate question since I've asked something similar like a day ago HOWEVER, if anyone sees any problem with this, please read my question first before judging:
Yesterday I tried getting a specific pixel from a fullscreen game in C#. I thought my C# code was faulty but when I tried with multiple full screen games today they all worked except for that specific game. I literally tried with 10 different full screen games, a couple being mmofps, mmorpg, mmotps, regular rpg games, regular shooters, regular action adventure games, etc. I tried with multiple programming languages, and with every game except that specific game I'm dealing with, it returns the pixel color to me like I wanted. So let me explain what I tried: first I tried returning an IntPtr
with C# using GetDC(IntPtr.Zero)
before invoking GetPixel(int x, int y)
and then getting the color out of it. Then I tried using the Robot
class in Java and using the getPixelColor(int x, int y)
method. I also tried using GetDC(0)
to return an HDC object in C++ and then invoking GetPixel(int x, int y)
before again extracting the color.
These three methods worked EXACTLY the same in every single game except that specific game I was talking about. They returned the pixel perfectly, and extracted the exact same color perfectly.
I don't feel it's necessary to tell you the game name or anything, since you probably don't even know it, but what could possibly be causing this malfunction in 1 specific game?
PS: The game ALWAYS returns an RGB color of: A = 255, R = 0, G = 0, B = 0
. Also, I tried taking a snapshot of the game with the 3 programming languages, and then getting the pixel which actually works in all 3 languages, but since I need to get this pixel every 30 ms, it kind of makes my game lag a bit (+ I think it takes up a lot of memory)
© Stack Overflow or respective owner