Maesy
asked on
Virtual Key Code
How can i get the virtual key code for a character?
their proberly is a simple function for this, but i don't seem to find it.
And i would also like to transfer into hex
thx in advance,
Maes
their proberly is a simple function for this, but i don't seem to find it.
And i would also like to transfer into hex
thx in advance,
Maes
user the function
WM_KEYDOWN,or WM_KEYUP
the other function WM_KEYPRESS or WM_CHAR not valide with virtual key
WM_KEYDOWN,or WM_KEYUP
the other function WM_KEYPRESS or WM_CHAR not valide with virtual key
Hi Maesy,
there's a function VkKeyScan() which returns a value which low-byte is the virtual key code for all characters ...
hope that helps,
ZOPPO
there's a function VkKeyScan() which returns a value which low-byte is the virtual key code for all characters ...
hope that helps,
ZOPPO
ASKER
sorry for the late answer, but i was away for the weekend,
thx for the answers but i forgot to say that i'm working in embedded visual c and there that function doesn't seem to work.
you are right jkr that it is the ascii code, but i have one more question how can i transfer dec to hex?
thx for the answers but i forgot to say that i'm working in embedded visual c and there that function doesn't seem to work.
you are right jkr that it is the ascii code, but i have one more question how can i transfer dec to hex?
you can do the function as
CString ToHex(int x)
{
CString S;
while (x)
{
int remain = x % 16 ;
x = x /16;
if (remain <10)
S.Format("%d%s",,remain,S) ;
else
S.Format("%c%s",'A'+(remai n-10,S);
}
if (S=="") S="0";
return S;
}
CString ToHex(int x)
{
CString S;
while (x)
{
int remain = x % 16 ;
x = x /16;
if (remain <10)
S.Format("%d%s",,remain,S)
else
S.Format("%c%s",'A'+(remai
}
if (S=="") S="0";
return S;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So, I did NOT answer the Q "How can i get the virtual key code for a character?"? Surprising, I thought I read it like that...
Hi jkr,
I agree ... therefor I added a Q to give you half of the points ... https://www.experts-exchange.com/questions/20801273/Points-for-jkr.html
See the good side: I promise to grade it with 'A' ...
Have a nice day,
regards,
ZOPPO
I agree ... therefor I added a Q to give you half of the points ... https://www.experts-exchange.com/questions/20801273/Points-for-jkr.html
See the good side: I promise to grade it with 'A' ...
Have a nice day,
regards,
ZOPPO
ASKER
excuse me
Zoppo, I won't even comment there :o)
hm, ok, jkr, it's your decision ...
regards,
ZOPPO
regards,
ZOPPO
/* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
/* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */