Symbian simulate keyboard input - c++

I have created a Qt background task that generates text on account of user input. My task runs when a text input field is open, what I now need is a way to insert text into the input of whatever application is currently open. I have looked at key press simulation but I cannot find a method that works.
Do you gave any idea what I can do?
PS. This is for Symbian^3(Belle) and Qt as well as Symbian C++ code will work.

On way to do it is
RWsSession sess=CCoeEnv::Static()->WsSession();
sess.SimulateKeyEvent(RFB::GetKeyEvent(code,ETrue));
User::After(200000);
sess.Flush();

Related

Windows Keybord display

I am trying to make an on screen keyboard for windows in C++ that rather than sends an input such as SendInput() takes intercepts the user inputs allowing the user to use a window and have the key press show on the on-screen keyboard.
I plan on using this as a way of making tutorials in programs such as unity and can be used as an overlay for people know play games. to do this I will need to take in the input without stopping it going to its destination but I don't know how.
Any help would be appreciated.

Key logger wont record key strokes without console

I created a small basic key logger in C++. For some reason when I compile and run the program with the console displayed, it will record every key stroke I make in whatever program I am using such as a browser and store it in a text file. However when I make it so that it WON'T display a console window, it will not record anything and it's just a process in the background doing nothing. Here is the link to my code: http://pastebin.com/4wqQyLJ9
The function that is giving me trouble with hiding the console, is the Stealth() function. Any suggestions, tips or hints will be helpful.
Use this function , it works for me pretty well.
ShowWindow(GetConsoleWindow(), SW_HIDE);
Instead of hiding the window after the program starts, I solved this by not
having a window to begin with. Compile with -mwindows and a window is not
created when the program starts.
Example
I would consider a Windows Service for this kind of thing if you don't need UI. Also using GetAsyncKeyState can be more stealthy if required. This C++ source might be of use...
Windows Service Keylogger

VC++ Making a single line text box act (mimic a button) on the return key

I am learning Visual C++ 2010 Express on windows XP
This must be a standard task I am trying to do!!!
I have a very basic form with an input text box, an output text box and a button
I enter a value into the input text box and press the button and the answer is displayed in the output text box.
This all works.
I want to press the return key after I have enterd the value into the input textbox (single line box) and have the answer displayed in the output textbox. (the same as pressing the button).
Is this not a simple thing to do?
Any help will be appreciated.
thanks
I hate to break the news, but you are not writing C++ code. The language you are using is called C++/CLI, a managed language that resembles C++ about as well as C# does. The dead give-away is writing code that uses the ^ hat. Easy to see in the code that the GUI designer generates for you.
The Express edition you use is a major cue, it only supports creating GUIs by using C++/CLI. By taking advantage of the Winforms class library and the designer it supports. Very nice, you can plop controls on a form and double click them to implement the default event. Adding the Click event for a button is trivial.
The native way, MFC, is not supported in that edition. And is urky, MFC has no designer support beyond creating dialogs.
Biggest thing about a GUI app is that is does not use the Enter key to move from one control to another. Users are familiar, and know, to press the TAB key instead. The Enter key is reserved to operate the OK button in a dialog.
It is not like you couldn't make it work, Winforms is flexible enough to let you trap the Enter key to change the focus. it is just that you shouldn't, users know when they are not working with a console mode app and are happy to use the TAB key.
Wrong language, wrong UI mode, not what the school you went to told you about, I guess. They don't.

Add console to existing MFC application

I'm working with 2 friends in a class project to make a D&D game. so far for the assignments I've been doing character creation stuff and strutting on the command line.
Now we're bringing or part together and I need to output ny dice rolls on a console and a few things on another one that will have to become the main view or tab or whatever it's called when it requires input/attention.
Problem is I never learned MFC yet because I didn't need it. How hard would it be to make a sample MFC console all that I can give to the teammate in charge of the GUI?
Could anyone point me to some instruction on making a console for an MFC app and how to give it output and receive output?
First, you can't. for both Unix/Linux and Windows, there is a one console/process limit. If you want another console, you have to create another process, that writes and reads the other console, while you send and receive the data.
You can use a NamedPipe http://msdn.microsoft.com/en-us/library/windows/desktop/aa365590%28v=vs.85%29.aspx to send data between processes, and the CreateProcess() function lets you create a process with a separate Console window.
Alternatively you can just write a Console-Look-a-Like window in some GUI.

How to send keystrokes to an application in C++

I'm trying to make a program to open Acrobat files using Adobe Acrobat Reader and save them in a text file, automatically.
What I want my program to do is:
open the pdf
send Alt + Tab //to move to the acrobat tab
send Alt + F //to open file
send Down Down Down Down (4 times) //to select 'save as text' option
send Enter // to save
I'm using Windows OS.
can someone please help me on how to do this?
Well my finel goal is to save the title and author of about 2500 pdf files in a database automatically, what are the better ways you suggested ? this was what i came up with.
Try AutoIt. From it's website:
"AutoIt is a freeware Windows automation language. It can be used to script most simple Windows-based tasks."
You're going to want to use Spy++ and watch the messages being passed to the window when you perform these actions (note that opening the PDF with Acrobat and grabbing the Window handle are different operations). From there, look into:
http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx
Win32 messaging is difficult if you're not used to it and fragile, as mentioned by #Alf. I'd suggest you try another approach, but if you Google "win32 sendmessage" or "win32 sendkeys" that should get you started.
Couple of things,
1) Simulating keystrokes to interact with another application is a very very bad idea. You're better off finding API's that'll do the same thing.
If you still haven't changed your mind, read further...
2) For Saving, Why not use Ctrl+S to save, Ctrl+O to open. I'm Sure you'll find direct shortcuts for the others too.
Here's a Project that might help.
You can use SendMessage API to send mouse and keyboard messages to a window, or you can use sendinput which simulates actual hardware events. I will agree with another person, use AutoIT