Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[HELP] Sending Keys to Process and how to get Pixels
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Wed May 02, 2007 6:40 pm    Post subject: [HELP] Sending Keys to Process and how to get Pixels Reply with quote

I was wondering how to send certain keys to specific processes through C++. I already know a way around the hooks any hack protection offers. I read about using HWND to get a process ID and use that somehow, but I need help with that.
Also on that note, i need help with getting a certain pixel in certain coordinates of that running process. How would that be accomplished?
If you any help please post,PM, AIM me(vegitodbz0),or add me on MSN([email protected])

Thanks
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed May 02, 2007 6:54 pm    Post subject: Reply with quote

Send a WM_CHAR message with wParam as the virtual key-code of your key
Back to top
View user's profile Send private message
the_undead
Expert Cheater
Reputation: 1

Joined: 12 Nov 2006
Posts: 235
Location: Johannesburg, South Africa

PostPosted: Wed May 02, 2007 6:58 pm    Post subject: Reply with quote

Code:
   HWND Hwnd = FindWindow("CLASS", "NAME");   
   COLORREF Clr;
   HDC Hdc = GetDC(Hwnd);

   while(!(GetAsyncKeyState(VK_F8)))
   {
      Clr = GetPixel(Hdc, 100, 100 );
   }


or something like that

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Thu May 03, 2007 12:15 pm    Post subject: Reply with quote

but doesn\'t getPixel only get pixels from a bitmap image? Or does it also work with running processes?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Thu May 03, 2007 12:29 pm    Post subject: Reply with quote

it does not only get pixels from a bitmap image, works for windows too
Back to top
View user's profile Send private message
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Thu May 03, 2007 4:15 pm    Post subject: Reply with quote

And could you just cout the Clr to get the value? Or do you have to do something special?
Back to top
View user's profile Send private message
the_undead
Expert Cheater
Reputation: 1

Joined: 12 Nov 2006
Posts: 235
Location: Johannesburg, South Africa

PostPosted: Thu May 03, 2007 5:31 pm    Post subject: Reply with quote

You could, yes.

However look here http://msdn2.microsoft.com/en-us/library/ms532655.aspx

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Fri May 04, 2007 8:05 am    Post subject: Reply with quote

Does getPixel work for C programming also?
Back to top
View user's profile Send private message
the_undead
Expert Cheater
Reputation: 1

Joined: 12 Nov 2006
Posts: 235
Location: Johannesburg, South Africa

PostPosted: Fri May 04, 2007 10:26 am    Post subject: Reply with quote

yes
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Fri May 04, 2007 11:00 am    Post subject: Reply with quote

How can you do FindWindow in C? When i try to use it in C it gives me the error:

Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri May 04, 2007 12:25 pm    Post subject: Reply with quote

undead's code is correct, you will have to show us the full (or at least surrounding) source code for us to see what you did wrong.
Back to top
View user's profile Send private message
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Fri May 04, 2007 12:42 pm    Post subject: Reply with quote

Lolz

Last edited by vegito616 on Wed Jul 04, 2007 10:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri May 04, 2007 12:56 pm    Post subject: Reply with quote

I see a lot of errors in your code you should fix.

sizeof ki should be sizeof(ki)

while (1) { if (Clr = 4294967295) <- should be while(Clr == 4294967295) //= assigns, == compares

and why aren't you initializing ki in the beginning of the code and instead choose to inside of the loop? stuff like dwFlags will never change..
Back to top
View user's profile Send private message
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Fri May 04, 2007 1:17 pm    Post subject: Reply with quote

I'm still getting this error:
2005\projects\rappelz\rappelz\rappelz.cpp(15) : error C2664: 'FindWindowW' : cannot convert parameter 2 from 'const char [8]' to 'LPCWSTR'

On this line:
HWND Hwnd = FindWindow(NULL, "Rappelz");
Back to top
View user's profile Send private message
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Fri May 04, 2007 1:27 pm    Post subject: Reply with quote

You could:

1. Use FindWindowA instead to used the ansi version of the api.
2. Add L in front of the string you're trying to use. Ex use L"This is a string" instead of "This is a string".
3. Use the TEXT macro, which just does the same thing as method #2.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites