|
Man I struggled with sending keys to another application, this was the solution! you sir, are a gem! Cheers
|
|
|
|
|
I am trying to send unicode characters e.g.ÂÖë@123
Does it work with above such characters
|
|
|
|
|
I posted this to your profile. Sorry about that. I am new to Code Project. Here is the post where I should have put it:
Hello there. I downloaded and made use of your SendKeys class for a project in one of my courses. I wanted to say thanks. It allowed me to complete my project where voice-to-text using Mirosoft's Speech Recognition SAPI is used to translate spoken words into C/C++ reserved words and symbols and fed to the text editor in Visual Studio. I did bump into a problem with sending the left arrow key. Your code kept identifying it as a left brace. So, maybe there is a problem in the binary search member function. I went to use a VKEY code for the left arrow and it went into an infinite loop. I took a look at your code and saw that the variable NumTimes at the beginning of the SendKeys method wasn't initialized. I set it to start off at 1. You might wanna take a look at that. Anywho, again, many thanks!
|
|
|
|
|
|
is there any way after i send some input text and simulate the submit button to get answer from the application ? somehow to scratch the response from focus api.
thanks
|
|
|
|
|
Is there a way to make SendKeys work when screen is locked on Windows 7? I need to send keystrokes to application by giving its window title and it doesn't in such situation.
|
|
|
|
|
Giving the application title is optional.
Behind the hoods, we just send keystrokes.
Dig deep in the sources and just make a program that keeps on sending the 'a' key for example. Lock your machine and then see if 'a' is being sent to the username/password login boxes.
Thanks,
Elias
|
|
|
|
|
Is there a way to make SendKeys work when screen is locked on Windows 7? I need to send keystrokes to application by giving its window title and it doesn't in such situation.
|
|
|
|
|
Is there a way to use this code in a v120 win32 console application instead of a CLR or windows forms application?
if not, would you go for a portable code?
greetz Chris
Just|live|a|Little
|
|
|
|
|
Yes, you can add the sendkeys.cpp/.h to your native console application and call the methods normally
|
|
|
|
|
i'm using this program to play with a piano simulator.
|
|
|
|
|
|
The binary search algorithm, in StringToVKey(), had a bug whereby {F1} was being returned as F16 (0x75) instead of returning F1 (0x70). By changing the following line of code within StringToVKey() the problem is resolved. It causes a comparison against the length of the string returned from the array, rather than the length of the KeyString.
int cmp = _tcsnicmp(KeyNames[Middle].keyName, KeyString, _tcslen(KeyNames[Middle].keyName));
|
|
|
|
|
|
A great piece of software - thank you
I have a dialog with a checkbox (without a keyboard accelerator) that I want to set before I 'Ok' out of the dialog.
I've tried {TAB}ing to the control and using {SPACE} in an attempt to select it but it doesn't work. Any ideas?
If it helps the class name of the checkbox control is "WindowsForms10.Window.8.app.0.378734a"
Toby
modified 28-Jun-14 17:07pm.
|
|
|
|
|
please help...in need to send virtual keypresses
|
|
|
|
|
Can we get this upgraded to support windows 7+
|
|
|
|
|
It is preferable if I could input key comands without having to bring the window into focus. Is this possible?
|
|
|
|
|
As far as I know you have to use another mechanism. I could be outdated / wrong of course.
Try investigating sending window messages WM_KEYDOWN or WM_KEYUP, etc....
|
|
|
|
|
|
I tried to write #include "SendKeys.h" but my programm got compilation error:
No such file or directory.
I use Dev-C++ 4.9.9.2!
Can you please help me?
modified 2-Jul-13 6:37am.
|
|
|
|
|
I tried to open the solution in VS2010
but I got an error when I try to run the solution
"Unable to start program 'D:\SendKeys\.\Debug\\SendKeysSample.exe'
The system cannot find the file specified"
|
|
|
|
|
I tried to use this code in Qt, but it has this main problem:
error: cannot convert 'const char*' to 'const TCHAR*'
|
|
|
|
|
Thank you for providing this code, it is very useful! However, I found two problems with AppActivate() by window title and class name:
First, this line does not work correctly when compiling for Unicode, leaving garbage in "titleclass" and causing grief later in the search:
memset(titleclass, 0, l1 + l2 + 5);
Should be modified to:
memset(titleclass, 0, (l1 + l2 + 5)*sizeof(TCHAR));
Second, the code in CSendKeys::enumwindowsProc() seems to match any window of the given class name (if wclass is not NULL), regardless of window title provided. The code as provided in this article is:
BOOL bMatch(FALSE);
if (wclass)
{
TCHAR szClass[300];
if (::GetClassName(hwnd, szClass, _countof(szClass)))
bMatch |= (_tcsstr(szClass, wclass) != 0);
}
if (wtitle)
{
TCHAR szTitle[300];
if (::GetWindowText(hwnd, szTitle, _countof(szTitle)))
bMatch |= (_tcsstr(szTitle, wtitle) != 0);
}
To make it work correctly I modified it to:
BOOL bMatch(FALSE);
if (wclass)
{
TCHAR szClass[300];
if (::GetClassName(hwnd, szClass, _countof(szClass)))
bMatch = (_tcsstr(szClass, wclass) != 0);
}
if (wtitle && (!wclass || bMatch))
{
TCHAR szTitle[300];
bMatch = FALSE;
if (::GetWindowText(hwnd, szTitle, _countof(szTitle)))
bMatch = (_tcsstr(szTitle, wtitle) != 0);
}
Greg
|
|
|
|
|
Hi,
Can you please tell how it can be achived to send above mentioned keys. I have checked your code and tried to send % key but it didn't worked for me. i am trying to achieve the same in c#.
Thanks in advance
Anant
|
|
|
|