How to take a press button event Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

How to take a press button event

Post by dkaip »

Hello. I have made a litle process program that runs at windows 10 background.
I dont know how to take an even, a press button, how must make the program to inspect OS events, a press button for example. There is a link to study some code?
Thanks
Jim.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to take a press button event

Post by doublemax »

I'm not sure i understand what you mean.

Do you want to detect buttons clicks in another application while yours in running in the background?

If yes, there is nothing in wxWidgets that does that in a crossplatform manner. Under Windows you can achieve this using hooks:
https://docs.microsoft.com/en-us/window ... owshookexw

I don't know how to do it under Linux or OSX.
Use the source, Luke!
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: How to take a press button event

Post by dkaip »

My program runs as a backgroud process and it must inspect if a certain group of buttons are press in keyboard.
There is no mater if buttons press in certain program or not.
Thank you.
Jim
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to take a press button event

Post by doublemax »

dkaip wrote:My program runs as a backgroud process and it must inspect if a certain group of buttons are press in keyboard.
There is no mater if buttons press in certain program or not.
Sorry, i still don't understand. Do you maybe mean "key" instead of "button"? Do you want to catch all keypresses? That would work with a keyboard hook from the link i showed above.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to take a press button event

Post by ONEEYEMAN »

Hi,
Could you give us an exact scenario you are looking for to catch?

Thank you.
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: How to take a press button event

Post by dkaip »

Sorry, with button i mean key of keyboard.(Not good in English).
The scenario is when the process run, if i press Q, W, and E, give me a message. That is for learning.
Thank you.
Jim
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to take a press button event

Post by doublemax »

dkaip wrote:Sorry, with button i mean key of keyboard.(Not good in English).
The scenario is when the process run, if i press Q, W, and E, give me a message. That is for learning.
https://stackoverflow.com/questions/229 ... nt-windows
Use the source, Luke!
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Re: How to take a press button event

Post by dkaip »

Very good example...
Thank you.
Jim
Post Reply