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 


[SOLVED] Intercepting mouseclicks/keystrokes

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Sat Nov 08, 2008 8:36 am    Post subject: [SOLVED] Intercepting mouseclicks/keystrokes Reply with quote

Hi,
I've successfully made a direct3d hook to display stuff over a gg-protected game. That's all working perfectly.
Now I want to display buttons and make them clickable. So what would be the best way to do that? I've heard of subclassing a window, and installing a windows-hook but I think gameguard will prevent me from doing that.
For intercepting keypresses, I could use GetAsyncKeyState/RegisterHotkey on every key but I don't think that's a good solution.
Suggestions would be appreciated.
Thanks in advance,
Tombana


Last edited by tombana on Sat Nov 08, 2008 9:28 am; edited 1 time in total
Back to top
View user's profile Send private message
--Pillboi--
Grandmaster Cheater Supreme
Reputation: 0

Joined: 06 Mar 2007
Posts: 1383
Location: I don't understand the question. Is this a 1 to 10 thing?

PostPosted: Sat Nov 08, 2008 8:47 am    Post subject: Re: Intercepting mouseclicks/keystrokes Reply with quote

Well, definitely not RegisterHotkey, as each key can only be used as 1 hotkey, destroying many other applications etc.
I'm not really sure about this sort of thing, but I just wanted to say that. Wink

_________________

Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair.
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Sat Nov 08, 2008 9:27 am    Post subject: Reply with quote

Nevermind, I solved it. I tried subclassing the window and it worked. I thought gameguard would prevent me to but they didn't.
Feel free to remove this thread.
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sat Nov 08, 2008 9:46 am    Post subject: Reply with quote

Well, If you also want to send keystrokes you can use the same method you use for hooking d3d on dinput. Then hooking the function that checks the key states and call it yourself in the hooked version then you can send your own keystrokes by adding it to the return array.
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Sat Nov 08, 2008 11:50 am    Post subject: Reply with quote

Well for sending keys I can just use a simple PostMessage (bypassed) or a CallWindowProc. I believe that for sending arrow keys I need to use dinput but I don't need arrow keys. (And with subclassing I cán intercept arrow keys) But thanks for the information anyway.
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sat Nov 08, 2008 12:06 pm    Post subject: Reply with quote

and thanks to you for helping me with the dx overlay thing. But now... I hooked everything but I don't know ho to draw graphics. fail eh?
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Sat Nov 08, 2008 12:31 pm    Post subject: Reply with quote

If you've successfully hooked everything, just try drawing some text:

Code:

LPD3DXFONT m_font; //Pointer to the font interface

//Create the font interface:
//pD3DDevice is the thing you got from CreateDevice
D3DXCreateFont(pD3DDevice, 20, 0, FW_DONTCARE, 0, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &m_font);

//At your EndScene hook add this:
RECT rct;
rct.top = 10; rct.bottom = 30; rct.left = 10; rct.right = 100;
m_font->DrawText(NULL, "Hi there!", -1, &rct, 0, D3DCOLOR_ARGB(255, 255, 0, 0));
//then call the original EndScene
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
Page 1 of 1

 
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