-
Registered User
yeah i am going to use GetLastError to check what it was. BTW plz get on AIM so i can explain how this works.
-
I just checked your code and found that the return value from GetPixel is always CLR_INVALID (0xffffffff) ie an error. Msdn ascribes this error "If the pixel is outside of the current clipping region". This is why the GetR/G/B macros are always returning 255.
-
&TH of undefined behavior
Originally posted by Ken Fitlike
I just checked your code and found that the return value from GetPixel is always CLR_INVALID (0xffffffff) ie an error. Msdn ascribes this error "If the pixel is outside of the current clipping region". This is why the GetR/G/B macros are always returning 255.
I noticed this too...I think that GetDeviceCaps(...) is getting the dimentions of the screen when his code is relative to the dialog......therefore an error
-
Registered User
ok so now my dilemma is that i need to get a handle to the active window at the time the key is pressed - but to scan a key whilst the prog is not on top requires me to do GetFocus which will stop me being able to scan the game. arrgg
-
&TH of undefined behavior
cppdude.....following on from our AIM conversation (sorry about this...I gotta reinstall that proggie...its giving me hell)
I'm pretty sure the error listed above is the reason why your proggie was getting duff results....You are getting coordinates for the centre of the screen.....but they dont relate to your program...
I have a nagging feeling that an autofire bot (after you kindly explained what this is ) for games like quake will not be too easy to do.......I have done very little game programming, but I remember that games often set the cooperation level to exclusive so that other programs do not hinder them....if this is the case then your program might not fair too well as it will be starved of messages while quake runs
For other programs...I guess you might be able to find the client window you want to read and get a hadle with say FindWindow() (You can use spy++ - an app with VC++ to find window information). You might then be able to call GetClientRect() on that window and get the centre that way....I'm thinking aloud here cuz I havent tested this or really thought it through properly.....
Sorry if I am not too positive here.....
Popular pages
Recent additions