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 


PostMessage problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Tue Aug 03, 2010 9:33 pm    Post subject: PostMessage problem Reply with quote

Hello,
Im sending a click to an window with PostMessage every 5 seconds. When I do any other input action in the target window while the click-message is sent (which happens prety ofthen), the click is sent, but ther other input action wont work.

The problem is pretty obvious. Before i sent the click, i have to check whether target's window procedure is already dispatching some other input actions or not. But i dont know how to do that.

Any ideas?

_________________
Back to top
View user's profile Send private message
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Wed Aug 04, 2010 9:04 am    Post subject: Reply with quote

no one?
_________________
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Aug 04, 2010 1:02 pm    Post subject: Reply with quote

SetWindowsHookEx ?
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 893

PostPosted: Wed Aug 04, 2010 1:57 pm    Post subject: Reply with quote

Are you on something newer than XP, perchance? I'm not terribly familiar with the new stuff, but I believe there are restrictions on what messages you can send to another app. If that is indeed the snag, you can try ChangeWindowMessageFilterEx.

Otherwise, you could see what happens if you substitute mouse_event() or a GetCursorPos/mouse_event/SetCursorPos for the message posting. Not as elegant, perhaps, but it might be worth giving a look.

Cheers,
adude
Back to top
View user's profile Send private message
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Wed Aug 04, 2010 2:52 pm    Post subject: Reply with quote

Thank you guys for your answers.

justa_dude wrote:
Are you on something newer than XP, perchance? I'm not terribly familiar with the new stuff, but I believe there are restrictions on what messages you can send to another app. If that is indeed the snag, you can try ChangeWindowMessageFilterEx.

Otherwise, you could see what happens if you substitute mouse_event() or a GetCursorPos/mouse_event/SetCursorPos for the message posting. Not as elegant, perhaps, but it might be worth giving a look.

Cheers,
adude
Thanks, im running on windows 7 but I would like to provide compatibility for lower windows versions as well. And i don't really like mouse_event()/SendInput() whatever in this case.

Slugsnack wrote:
SetWindowsHookEx ?
Could you pls explain what you mean by this api? How should i use it to solve my problem?
_________________
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 893

PostPosted: Wed Aug 04, 2010 3:37 pm    Post subject: Reply with quote

If the UAC is indeed the problem, then compatibility with lower versions isn't an issue - since UAC doesn't exist on XP and lower, you can post messages with reckless abandon (WM_TIMER used to be kinda' popular...). I suggested trying the mouse_event because it would be good in troubleshooting to know if it worked or not. It would let us know that you are targeting the wrong child window or that the UI doesn't use the standard messaging for mouse input or ...

Slug suggested SetWindowsHook because it would let you hook the message map of all running applications. You could then queue the messages as you saw fit. It would probably work, but it's a lot more work to implement and probably less portable (since Vista+ users are probably on 64-bits and XP on 32).

Cheers,
adude
Back to top
View user's profile Send private message
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Wed Aug 04, 2010 6:32 pm    Post subject: Reply with quote

I think you misunderstood something. The clicks are sent, it works. My problem is basically that sometimes when i do something with the window like moving it, clicking in it etc.. it behaves weird. When I am moving the window for example while the clicks are sent, the window jumps back to its original position.
I need to find a way to delay the WM_LBUTTONDOWN/WM_LBUTTONUP messages while something is going on in the message queue.

_________________
Back to top
View user's profile Send private message
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Thu Aug 05, 2010 9:19 am    Post subject: Reply with quote

I just tried SendInput/mouse_event and it has the same problem. When I use the function and move the window at the same time the window jumps back to its original position when the clicks are sent.

So that leads to the conclutsion that the function is not the problem.

_________________
Back to top
View user's profile Send private message
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Fri Aug 06, 2010 8:13 am    Post subject: Reply with quote

Ok. I think i am an dumb idiot. Instead of dealing with all this message queue crap i should keep it simple. I "solved" the problem by just checking whether the left mouse button is pressed or not when i wanna send the click.
Code:
if GetAsyncKeyState(VK_LBUTTON) >= 0 then
//send the fucking click
Im such an stupid idiot -.-
_________________
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