Visual C++ :: Low-Level Keyboard Input Detection?
Mar 13, 2014
I am writing an software that should be able to detect all keyboard inputs by the user. i.e., both hardware and software/on-screen keyboard.
This software is going to be written in a platform independent way and supposed to run on Windows, Linux, Android & iOS.
The idea is to capture the keyboard inputs from a low level, there by making sure that it doesn't miss any inputs even if it's a on-screen keyboard like in a mobile device.
I am looking at possible open source libraries that can be used.
View 1 Replies
ADVERTISEMENT
Oct 29, 2014
I need to distinguish between number (float) and other non number characters. I was trying to use this:
Code:
#include <stdio.h>
#include <ctype.h>
float Ax;
...
scanf("%f
",&Ax);
if (isdigit(Ax)) {....}
And whatever I type I receive "Segmentation fault". How can I detect that the float input is correct? Is there any built in function?
View 7 Replies
View Related
Oct 6, 2012
i wish to plot a mathematical function on a 2-dimensional grid. The function will be represented by 3 sets of floats, x-values, y-values, and z-values. Obviously, it is impossible to plot 3 such data sets on a 2D grid, so one approach is to use pixel coloration to represent the z-values.
Those examples (and there are many to be found) show something like the function of the complex variable z, f(z) = exp(z). I have attached a exp(z).jpg example of the imaginary part of the plot exp(z).
My question is: How to accomplish such a gradient colorization, assuming one already has the data?
I have experimented with Gdiplus SetPixel, but I have not figured out how to produce a smooth gradient.
Here's my attempt to create a simple gradient:
Code:
CDC * pDC = GetDC();
Graphics graphics(pDC->m_hDC);
CRect r;
GetWindowRect(&r);
ScreenToClient(&r);
[Code] ....
View 1 Replies
View Related
Aug 31, 2013
I am trying to get my keyboard input into a function, so that I can call a function like updatebuttons() and set global variables to 0 if the button is not down at the moment and 1 if it is. It seems simple, but I can't seem to get it to work right; I am not use to working outside of windows, so I am still a beginner with SDL.
View 4 Replies
View Related
Feb 22, 2015
I'm not finished with this code, but I am stuck on this one glitch. This is what I have so far, and it's not working.
Code:
int main() {
/*Please input an n value greater than zero. Otherwise, exit the program by entering a carriage return*/
printf("Please input an n value greater than zero. Otherwise, exit the program by entering a carriage return
");
int summation = 0, x, y;
scanf("%d", y);
for (y == x; summation <= M_E && x <= 34; x++)
[Code] ....
View 1 Replies
View Related
Oct 12, 2014
Intead of using scanf("%d",&a) to take a input from the user,how to take a input using fgets(buffer, BUFFERSIZE , stdin) and atoi?
View 1 Replies
View Related
Nov 22, 2013
at the moment my program is extracting keyboard data through accessing the virtual key states. However, it is not performing as I intended because the data I receive from the console does not concur with the actions the user performed.
E.G. When I type, it comes out like this.
what I get with my program: WWhhhheeen III typeeee, iiit ccoommes oout lllikkke thhhhiiis
TLDR: so basically Id like to know how other programs know how to interpret keyboard input, so that when I type I dont get multiple inputs of the same key press
View 2 Replies
View Related
Nov 26, 2014
I'm trying to simulate a ctrl+ keypress into a running application.
Code:
#include <stdio.h>
int main (void) {
system("/usr/local/bin/rundb");
}
My problem is that the rundb program needs the user to type ctrl-b then s to actually start executing. What is the best way to handle this automatically? Some sort of fork/pipe?
View 3 Replies
View Related
Nov 18, 2013
I am trying to Write a program that inputs three integers from the keyboard and prints the sum, average, product, smallest and largest of these numbers. How do i go about it. What i dont know is how to come up with smallest and largest number .
View 1 Replies
View Related
Mar 30, 2014
I'm trying to write a C++ program that will allow a user to input a number from the keyboard. Then using a loop, that will perform 10 times, multiply the entered number by the loop counter. Print out the loop counter, the entered number and the product of the loop counter and the entered number. A one-time heading should be displayed before information is printed.
This kinda of what I have so far:
#include <iosteam>
using namespace std;
int main () {
Start
Declare: numScores, sum, score, avg, SENTINEL = 200
numScores = 0
[Code] ....
All the programs I have tried to make are not working?
View 4 Replies
View Related
Dec 6, 2013
By using visual studio 2010, I have problem calling up on screen keyboard using line below for Windows 7 64 bit.
WinExec("OSK.EXE", SW_SHOW);
However, it is working fine on windows XP 32 bit. How to call up on screen keyboard for 64 bit windows?
Code:
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) {
int nRetCode = 0;
HMODULE hModule = ::GetModuleHandle(NULL);
if (hModule != NULL) {
// initialize MFC and print and error on failure
[Code] ...
View 2 Replies
View Related
Feb 6, 2015
I downloaded Visual Studio 2013 on a new laptop. On my old one I could press things like ctrl + F7 to compile and ctrl + F5 to start without debugging however now it isn't responding when I type those commands. Nothing happens at all. How to change this? I googled "keyboard shortcuts not working in Visual Studio 2013" but per the usual Google comes up with garbage search results that do not pertain at all.
View 1 Replies
View Related
Oct 4, 2013
I have a C++ WIN32 DLL that acts as a server for a UI. Now i want to capture all keyboard inputs in the PC on the WIN32 dll, whenever the UI has active focus. If the user is typing something into another app, i don't care.
The trick is that, the keyboard can be both a software keyboard or a hardware keyboard. I want to be able to capture every keyboard input from the user on the PC in which the UI and DLL is running.
Is this possible to do? How can i implement this?
View 1 Replies
View Related
Oct 30, 2014
i got project to make a program of text predictor. i know the concepts of c++. array, classes , recursion, in data structure linked list, stack, queues and trees etc.. but i still need to make fast and efficient program of text predictor.
i got data in file.txt , in fact it is a dictionary data.....
View 14 Replies
View Related
Mar 27, 2014
I am writing an application that needs to temporarily disable the Play/Pause button that appears on multimedia keyboards.
Normally, a key can be blocked quite easily by installing a low level keyboard hook (WH_KEYBOARD_LL) where the KeyboardProc intercepts the key (in this case VK_MEDIA_PLAY_PAUSE) and returns a "1" instead of calling CallNextHookEx. I have tried this with other keys (including the Windows key VK_LWIN) and this works perfectly. I also have no problems with this method under Windows 7 where all keys, including VK_MEDIA_PLAY_PAUSE get blocked.
Windows 8 is a different story. When my application has input focus, everything works as expected, meaning the VK_MEDIA_PLAY_PAUSE key gets blocked and no other application responds to it. However, when my application loses focus, my hook procedure gets called (this was verified by sending out a OutputDebugString) but other applications respond to key even though I return a "1". As soon as my app gets focus again, everything is block as it should.
After some investigation, I found that the multimedia keys not only generate keystrokes but also generate WM_APPCOMMAND messages so I added ShellProc (WH_SHELL) hook with the following hook procedure:
LRESULT __declspec(dllexport)__stdcall CALLBACK ShellProc(int nCode,WPARAM wParam,LPARAM lParam) {
// Do we have to handle this message?
if (nCode == HSHELL_APPCOMMAND) {
OutputDebugStringX(">>>>> HSHELL_APPCOMMAND");
[code]....
This procedure is only getting called when my app has input focus. Whenever I have input focus and return "1" the Play/Pause command gets blocked. As soon as I lose focus the procedure does not get called/hooked.
As I have mentioned, the code works for other keys, just not the multimedia keys.
Alternatively, another way of blocking the multimedia keyboards Play/Pause button?
View 6 Replies
View Related
Mar 10, 2013
Actually the below program is for Dispersal Algorithm called Rabin-IDA; this algorithm divided the data into N pieces and then recombine it from M pieces (such that M<N).
Thus, the below program needs command line arguments,which entering by Project properties/Debugging. this argument is file name, where the program performing spitted the file into N files, and then recombine it from M divided files, and put it on another file which should also passing its name as argument .
Now my question is, How can i make this program enter the file name by keyboard??(i mean enter the files name by user from screen not as command line arguments) ... In another word, How I can exchange ?
Code:
argc == 3
and
Code:
argc == 2
To enter file name ? i mean what i should do to in
Code:
rabin.split(argv[1])
To pass my file name by use keyboard not Project properties/Debugging?)
the below code is just the main function of program, and the whole of it in this link [URL] .... Information Dispersal Algorithms Rabin-IDA.
Code:
#include "include.h"
void __cdecl _tmain(int argc, TCHAR *argv[]) {
DWORD ini=GetTickCount();
try {
if( argc == 3 ) //recombine
[Code] ....
I know I should use getline() function but how exchange argv[] ?
View 1 Replies
View Related
Aug 10, 2013
I am writing a program to map keyboard and mouse to an xbox 360 controller with win32 and xinput. I have everything going fine but when im trying to control the mouse with the thumbsticks I get problems with the movement if my program has the focus it moves fine but when I put another window in focus the movement is over sensitive here is the code I am using
Code:
if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) {
GetCursorPos(&mousepos);
profile->Buttons[6]->input.type = INPUT_MOUSE;
[Code] .....
I have tried everything to fix it.
View 1 Replies
View Related
Mar 6, 2015
I want to track the mouse movement. I know that GTk+ provides some powerful libraries for creating GUI, that will, among other things, enable me to write handlers for mouse movement events, but I'm looking for a simpler, more compact capabilities for now.
Is there a low level C library that will enable me to interface with the mouse?
View 5 Replies
View Related
Oct 20, 2012
With what protection level c# treats variable "a" in "myclas", because I get error code when I want to change it?
Code:
using system;
class myclass {
int a;
}
class mainclass {
[Code] .....
View 4 Replies
View Related
Jan 2, 2014
So I am have made this 2D ball game. But I want to set a time limit for each level. I want player to play that level for maximum 3 minutes. After 3 minutes the game level should end. I have used allegro 5.0.10 with c++ . How to achieve it?
View 2 Replies
View Related
May 16, 2014
take a look at this project : [URL] i want to change this project for this purpose : when a USB PRINTER is connected show a message that tell us -> hey this is a printer. which part of this project should i change and how can i separate printer devices from the others?
note: if you are using visual studio 2010 or higher and get error for this line after conversion :
#define _WIN32_WINNT 0x403
just replace all of such these lines to stdafx.cpp file. means stdafx.cpp at last should be like this :
// stdafx.cpp : source file that includes just the standard includes
// HWDetect.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#define _WIN32_WINNT 0x403
#include "stdafx.h"
View 1 Replies
View Related
Jun 11, 2014
I have to create a 2D link list with 2 level hierarchy
some thing like that
Code:
head nodes level 1: 0 1 2
/| / /|
Sub node level 2: 0 1 2 0 1 0 1 2
Real Data under |
each sub node: |
int **join=Null;
int unique = 0;
int col;
int ptr;
int *tmp_perm=Null;
int col_elem;
I know how to deal with 1 level link list structure. But i don't know how to access, delete, nodes and sub nodes from this 2 level hierarchy. C
View 4 Replies
View Related
Mar 7, 2013
I want to access sata hard drive(eg. D drive) at sector level using C programming.I want to read the values stored in the memory locations.
View 3 Replies
View Related
Jan 21, 2013
How to create a symbol table for an assembly language and high level language in c++?
View 1 Replies
View Related
Apr 18, 2012
What is Multi-level algorithms for date-driven scheduling?
View 8 Replies
View Related
Jan 20, 2015
Still working with SDL2 and c++ my map collision is messed up since I implemented my Camera.
I do understand that everything has a relative Position on the Screen, depending on the camera.
Problem No. 1: The camera is not moving as fast as the Player, despite having the absolutly same velocity (4/-4)??? How can this be O_o
Problem No. 2: My tile collision is totally messed now. Probably its because of the difference between the Player Position and the camera :/ So if you can solve Problem no. 1, Problem number 2 might work out on its own :)
I will upload the code to github [URL] .....
View 11 Replies
View Related