Hey all .. i wanted to know, in C++/Qt, how can one detect with how much pressure the screen is being pressed when a project is on the N900 ?.. Can anyone help me on this ?
Its very much possible to get pressure data. In GTK/GDK you register for all extension events with gtk_widget_set_extension_events()
gtk_widget_set_extension_events(widget, GDK_EXTENSION_EVENTS_ALL);
and you will start receiving move/pressure events as well. The link Olorin posted could be the Qt interface for the same, but I haven't used it so cannot say for sure.
Related
This question was originally about how to trap mouse events, which i solved after a lot of research using SetWindowsHookEx with C++.
Problem is, its working for me on Windows, it works in applications, but it doesnt work in games.
can somebody help me understand why the mouse hook doesnt work in some games? could it be possible all the games i tried use Raw Input? :S
(i tried Ibb&Obb, Fallout 4, Metro Last Light and some other titles)
Basically im asking: how is it possible to use a Mouse Hook to trap it globally in all the applications running?
thanks for the helpers.
EDIT : I found out that most games i play use DirectInput. guess the better question is: How can i intercept mouse messages in DirectInput and prevent them from being registered by the game? i want to be able to drag the mouse and it would have no effect on the game.
after a lot of research i found out that, from what i understood, API Hooking (Microsoft Detours, API Hijack and more) is the only way to do it.
Important note: it doesnt help me much since API Hooking for games require DLL injection which will get you banned from Steam and other platforms.
I bought a physical button and hooked it up to my computer, using the Arduino it communicates over USB serial to a C++ program I'm writing. Now I want to make the button simulate a keypress on my computer so I could use it as an alternative controller for the games I play.
If you are not familiar with Arduino, don't mind it, my problem lies completely in C++
The solution for this is pretty simple, it basically boils down to using SendMessage to a window with keystrokes, or many alternative methods like sendKeys and what not.
I have tried every single library or windows function that could handle something like this, but none of them actually simulates a keystroke being pressed by a keyboard.
Everything I tried so far has worked in many programs like Notepad and Chrome but none works with a game that doesn't listen to windows messages to handle key input.
My guess is that these games use GetAsyncKeyState which is communicating with the physical keyboard in a direct manner.
How could I resolve this? What API provides such functionality?
I need something very low level here, maybe even a program that emulates a new keyboard so windows thinks I have plugged in a physical one.
This would help me ALOT I've encountered this problem numerous times and I will keep encountering it in the near future with other projects.
I hope someone can help,
Thanks!
Use keybd_event() or SendInput()
I'm writing a game in C++, and I'm trying to get it to recognize keyboard and mouse events. Google tells me that boost.signal is suitable for event handling, but none of the code samples or tutorials I've found tell me how to associate a keypress or mouseclick with a function. Can anyone shed any light on this?
I think taking a look at SDL and it's SDL input subsystem might give you some hints. It all depends on what is the source of your keyboard and mouse events. Is it SDL? DirectX? If neither, then you're probably doing it wrong :).
The events that you receive will depend on the operating system you're using, and any frameworks that stand between you and the OS. Qt is a popular cross-platform framework, for example.
If you're not using a GUI library or other type of engine that already provide you input informations, a good library to just get inputs is OIS : http://sourceforge.net/projects/wgois/
Basically I'm currently using the wiiuse library to get the wiimote working on linux. I want to now be able to control the mouse through the IR readings.
Can somebody point me in the right direction as to how to approach this? I know of uinput but there doesn't seem to be a lot of tutorials/guides on the web.
I'm working with c/c++ so a library in c/c++ would be helpful.
Cheers.
I think you should look into "becoming" a new mouse device. This would require developing a device driver that knows how to read the Wii device, and present that data to the input system as if it came from a mouse. The Linux kernel supports multiple mice connected at the same time, and merges the inputs from all of them, so this will work fine.
This book might be a handy help along the way. Not sure if it's possible to do this totally in userland, but that is of course worth investigating too.
I`m not sure if I understood you question corectly. If looking for controling mouse pointer from userspace look at XTest Extension Usefull link
Edit:
From kernel POV uinput looks like good starting point
In the end I decided to just draw "cursor" objects on the screen and use setup each input device to control a separate "cursor" object. This seemed the best idea as we were short on time.
I have an iMac, and I want to be able to turn off the monitor when I go to sleep,. Alas, the iMac has no switch for this. I do not want to put the iMac into sleep mode, i want to write a "expose" like application or service, which when the mouse is put into the upper left hand corner of my screen, the display will sleep. Likewise, if i move the mouse away, it comes back.
Does anyone have experience with tracking mouse movements within the Windows and Display APIs I'd need to look up. I just need some direction to get started.
Cheers!
Chris
I've been asked to clarrify. Sorry if i'm confusing anyone. I'm running Windows Vista 32 via Bootcamp. I like that Mac OSX has a "hot corners" feature via Expose. I have noticed that besides power managment which runs on a time metric, there is no way to sleep the display at will in Vista.
I would like to write my own tool for this. I might be a glutton for punishment, but i'm a coder, and it's a good excuse to learn something new.
In Leopard, you can just go to "System Preferences" and "Desktop & Screensaver". Click the Screensaver tab, click "Hot Corners", selected the corner you want to change, then chose "Sleep display". Does that not work?
If it's an old CRT iMac then you can't switch off the screen without switching the computer off - the convection from the CRT is used to cool the processor!
Not really the answer you seem to be looking for, but cant you do this via the power save option and/or the screen saver - can it be set to nothing.
Can you not use the monitor power button?
Thanks for the clarification, Chris. I would reiterate:
just use a pre-existing solution like this: http://www.southbaypc.com/HotCorners/ (untested anything that does the same thing would work). If it allows you to run your pre-selected screensaver, then all you need to do is ...
... make an exe that does what you want (sleep the screen) and then rename it whatever.scr http://computer.howstuffworks.com/screensaver.htm/printable Do you have this working yet?
Once you get that working (and you can enjoy a Windows version of your desired OS X hot corners functionality) then worry about how hot corners are implemented. Your Win32 API question is still a good question but like you said you sound like you want to build it yourself. If that is the case, I would post a new question "Hot corners in Windows Win32 API Low level mouse tracking" or something to that effect and just ask: "how do these Hot Corners programs detect hot corner mouse-over events?" By the way my brother used the low level API to move the mouse cursor and simulate clicks so I know what you're asking is probably possible. It's just that your REAL question seems barried in all this discussion.