Hotkeys are fun. :)
Here's a way I managed to manually convert a returned VKey into ASCII characters so it can be displayed or stored in an .ini file or whatever. Here the hotkey was F3 (VKEY=72h) A normal hex-to-string conversion will not work because the 72h represents a DECIMAL 72d, but in hex notation. Confusing!
invoke SendDlgItemMessage,hWnd,IDC_HOT1,HKM_GETHOTKEY,0,0 ; result in eax
mov ecx,offset szBuffer ; dest buffer pointer as ecx
shl eax,24 ; strip off all but al (72h)
shr eax,24 ; move lone value back to al
shl eax,4 ; put each nibble in own byte (07h,20h)
shr al,4 ; correct al (07h,02h)
add ax,3030h ; add 30h to each to make ASCII
mov dh,al ; swap bytes
mov dl,ah ; (32h,37h)
mov word ptr [ecx], dx ; output two bytes (in logical order)
I'm not very familer with the SendDlgItemMessage function, but does the following do the same thing?
invoke SendDlgItemMessage,hWnd,IDC_HOT1,HKM_GETHOTKEY,0,0 ; result in eax
mov ecx,offset szBuffer ;??????????????????????
mov ah, al
shr al, 4
and F0Fh
add ax, 3030h
mov word ptr [ecx], ax
i think you mean and ax,0F0Fh ;)
Quote
i think you mean and ax,0F0Fh ;)
Oops...
I was in a hurry to go to lunch. Thanks.
can't u use BCD instructions for that... if 72h represents 72d then thats a bcd