Troudeloup
asked on
VK_RETURN
string string1 = "VK_RETURN";
BYTE vk = LOBYTE(::MapVirtualKey( string1, 0));
keybd_event( string1,vk,0,0);
keybd_event( string1,vk,KEYEVENTF_KEYUP ,0);
BYTE vk = LOBYTE(::MapVirtualKey( string1, 0));
keybd_event( string1,vk,0,0);
keybd_event( string1,vk,KEYEVENTF_KEYUP
What is your question?
ASKER
well, I want to use
keybd_event() to press keyboard key SHIFT.
but i don't want to write a function for that:
void enter()
{
BYTE vk = LOBYTE(::MapVirtualKey(VK_ ENTER, 0));
keybd_event(VK_ENTER,vk,0, 0);
keybd_event(VK_ENTER,vk,KE YEVENTF_KE YUP,0);
}
plus, I think it's possible to contain VK_ENTER
like this
string1[6] = VK_ENTER
keybd_event() to press keyboard key SHIFT.
but i don't want to write a function for that:
void enter()
{
BYTE vk = LOBYTE(::MapVirtualKey(VK_
keybd_event(VK_ENTER,vk,0,
keybd_event(VK_ENTER,vk,KE
}
plus, I think it's possible to contain VK_ENTER
like this
string1[6] = VK_ENTER
ASKER
uh sorry, it's this
BYTE vk = LOBYTE(::MapVirtualKey( VK_RETURN, 0));
keybd_event( VK_RETURN,vk,0,0);
keybd_event( VK_RETURN,vk,KEYEVENTF_KEY UP,0);
BYTE vk = LOBYTE(::MapVirtualKey( VK_RETURN, 0));
keybd_event( VK_RETURN,vk,0,0);
keybd_event( VK_RETURN,vk,KEYEVENTF_KEY
If I remember correctly, you can simulate the shift key with
keybd_event(VK_SHIFT,1,0,0 );
keybd_event(YourKeyHere,1, 0,0);
keybd_event(VK_SHIFT,1,KEY EVENTF_KEY UP,0);
and the return key with
keybd_event(VK_RETURN,1,0, 0);
keybd_event(VK_RETURN,1,KE YEVENTF_KE YUP,0);
Give me a little time to put a test program together.
Joe
keybd_event(VK_SHIFT,1,0,0
keybd_event(YourKeyHere,1,
keybd_event(VK_SHIFT,1,KEY
and the return key with
keybd_event(VK_RETURN,1,0,
keybd_event(VK_RETURN,1,KE
Give me a little time to put a test program together.
Joe
ASKER
more precisely:
string = "HELLO"
I want it to be upper case letter when it's printed.
this now it is lower case.
string = "HELLO"
I want it to be upper case letter when it's printed.
this now it is lower case.
OK
ASKER
stop, please try to do this
string = "HellO"
keyboard_event to send upper and lower case letter.
another example is 1 and !
the current code would send only 1 and never !
I am trying to write a parser so that
string string1 ="Hello"
should be like this
string2 =
[0] = shift
[1] = h
[2] = shift up
[3] = e
[4] = l
[5] = o
[6] = o
If string[n] == "H"
test is c++ can tell the difference between upper and lowercase
plan:
loop
{
if string[n] == upper case
string2[n] = shift
string2[n+1] = string1[n]
string2[n+2] = shift
}
send string2 to output
string = "HellO"
keyboard_event to send upper and lower case letter.
another example is 1 and !
the current code would send only 1 and never !
I am trying to write a parser so that
string string1 ="Hello"
should be like this
string2 =
[0] = shift
[1] = h
[2] = shift up
[3] = e
[4] = l
[5] = o
[6] = o
If string[n] == "H"
test is c++ can tell the difference between upper and lowercase
plan:
loop
{
if string[n] == upper case
string2[n] = shift
string2[n+1] = string1[n]
string2[n+2] = shift
}
send string2 to output
ASKER
ignore this line
If string[n] == "H"
test is c++ can tell the difference between upper and lowercase
that's my own note ;p
If string[n] == "H"
test is c++ can tell the difference between upper and lowercase
that's my own note ;p
ASKER
if the case of 1 would !
of course the solution is also
shift down
1
shift up
and it should be dealt by the parser, if one is needed. ( i am not sure)
of course the solution is also
shift down
1
shift up
and it should be dealt by the parser, if one is needed. ( i am not sure)
I'm a little confused, but it seems like you want
1) A way to mark where the shifted character(s) is/are in a string
2) A way to send the shifted characters
Am I right?
You might use "0hello" to send "Hello", for example.
And "4hello" to send "hellO"
1) A way to mark where the shifted character(s) is/are in a string
2) A way to send the shifted characters
Am I right?
You might use "0hello" to send "Hello", for example.
And "4hello" to send "hellO"
ASKER
I want a function to output case correct strings on notepad give this
correctstring ("HeLLo")
and this doesn't pop up
hello
instead,
the intuitively expected
HeLLo
does.
makes sense?
correctstring ("HeLLo")
and this doesn't pop up
hello
instead,
the intuitively expected
HeLLo
does.
makes sense?
Yes, it does. I'm trying a small test program now. Having a couple of difficulties with it. Stay tuned...
I have some progress. This small program sends a capital Q to the window that has focus.
Unfortunately, it leaves the Caps Lock on...I'm looking into that
#include <windows.h>
void SendShiftedChar(char aChar) {
BYTE aByte = (BYTE)aChar;
keybd_event( VK_CAPITAL ,0x45,KEYEVENTF_EXTENDEDKE Y | 0, 0 );
keybd_event( aByte, 0, 0, 0 );
keybd_event( aByte, 0, KEYEVENTF_KEYUP, 0);
keybd_event( VK_CAPITAL, 0x45,KEYEVENTF_EXTENDEDKEY , 0 );
}
void main() {
::Sleep(5000); // Gives time to click Notepad
SendShiftedChar( 'Q' );
}
Unfortunately, it leaves the Caps Lock on...I'm looking into that
#include <windows.h>
void SendShiftedChar(char aChar) {
BYTE aByte = (BYTE)aChar;
keybd_event( VK_CAPITAL ,0x45,KEYEVENTF_EXTENDEDKE
keybd_event( aByte, 0, 0, 0 );
keybd_event( aByte, 0, KEYEVENTF_KEYUP, 0);
keybd_event( VK_CAPITAL, 0x45,KEYEVENTF_EXTENDEDKEY
}
void main() {
::Sleep(5000); // Gives time to click Notepad
SendShiftedChar( 'Q' );
}
OK, this sends a capital H.
#include <windows.h>
void CapsLock() {
keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
}
void SendChar(char aChar) {
BYTE aByte = (BYTE)aChar;
keybd_event( aByte, 0, 0, 0 );
keybd_event( aByte, 0, KEYEVENTF_KEYUP, 0);
}
void SendShiftedChar(char aChar) {
CapsLock();
SendChar(aChar);
CapsLock();
}
void main() {
::Sleep(3000); // Gives time to click Notepad
SendShiftedChar( 'H' );
}
#include <windows.h>
void CapsLock() {
keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
}
void SendChar(char aChar) {
BYTE aByte = (BYTE)aChar;
keybd_event( aByte, 0, 0, 0 );
keybd_event( aByte, 0, KEYEVENTF_KEYUP, 0);
}
void SendShiftedChar(char aChar) {
CapsLock();
SendChar(aChar);
CapsLock();
}
void main() {
::Sleep(3000); // Gives time to click Notepad
SendShiftedChar( 'H' );
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.