Article View: borland.public.cppbuilder.nativeapi
Article #2947keyboard event for special characters
From: DeKayA
Date: Wed, 18 Oct 2006 17:33
Date: Wed, 18 Oct 2006 17:33
55 lines
2183 bytes
2183 bytes
Maybe I am doing this all wrong!
Code follows the narration...
I am retrieving characters from a listbox and sending them one at a
time to a running DOS program. (win2k CMD actually)
The program was selected in a previous routine and the characters are
indeed sent to the open CMD prompt.
I have noticed all character must be in upper case for the cmd to
receive them so, as an example the text box has the following lines in
it.
TELNET MAIL.SOMEWHERE.COM 25
HELO ME
This works but the "." is not interpreted correctly
I discovered that a lower case "n" is interpreted as a .
MAIL FROM: SOMEONE@SOMEWHEREnNET // notice the "n" for a period
RCPT TO: dekaya@SOMEWHEREnNET
But that is not the correct approach because I can't send the needed @
symbol
DATA
From: RemoteAccess
To: SOMEONE@SOMEWHERE.NET
Subj: What is My IP Address
Bottom line: How do I send CR/LF and special characters
---------------------------------------------------------
void __fastcall TForm1::SendKey(String SCharacter)
{
HWND handle;
handle = FindWindow(NULL, EditTargetApp->Text.c_str());
if(handle != NULL)
{
char *character = SCharacter.c_str();
// bring it to the front
SetForegroundWindow(handle);
// send the letter to the program; parameter MUST be uppercase
keybd_event(*character, 0, 0, 0);
keybd_event(*character, 0, KEYEVENTF_KEYUP, 0);
}
}
Technical Details
Message-ID:
<45366331.17177459@forums.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8b5b289e42156a77,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: DeKayA@bellsouth.net Newsgroups: borland.public.cppbuilder.nativeapi Subject: keyboard event for special characters Date: Wed, 18 Oct 2006 17:33:42 GMT Message-ID: <45366331.17177459@forums.borland.com> X-Newsreader: Forte Agent 1.5/32.452 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 65.8.31.169 X-Trace: newsgroups.borland.com 1161192884 65.8.31.169 (18 Oct 2006 10:34:44 -0700) Lines: 55 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail