keyboard events - How to post Extended ASCII chars (0x80 to 0xFF) using PostMessage in Delphi? -
i writing keyboard mapper application in need send extended ascii chars (0x80 0xff) current window. have tried below
function constructlparam(vkey: word): longint; // cardinal; begin { constructlparam } if vkey > $ff result := longint(mapvirtualkeyw(vkey, 0) , $00000fff or $f000) shl 16 or 1 else result := longint(mapvirtualkey(vkey, 0) , $000000ff or $ff00) shl 16 or 1; end; { constructlparam } procedure postcharacter(targetwinhandle: hwnd; unicodevalue: word; ime_msg, widefunction, simulatekey, sendmsg: boolean); begin { postcharacter } if sendmsg // sendmsg fn if ime_msg // ime msg if widefunction // wide fn begin if simulatekey sendmessagew(targetwinhandle, wm_ime_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); sendmessagew(targetwinhandle, wm_ime_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey sendmessagew(targetwinhandle, wm_ime_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end else // not wide fn begin if simulatekey sendmessage(targetwinhandle, wm_ime_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); sendmessage(targetwinhandle, wm_ime_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey sendmessage(targetwinhandle, wm_ime_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end else // not ime msg if widefunction // wide fn begin if simulatekey sendmessagew(targetwinhandle, wm_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); sendmessagew(targetwinhandle, wm_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey sendmessagew(targetwinhandle, wm_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end else // not wide fn begin if simulatekey sendmessage(targetwinhandle, wm_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); sendmessage(targetwinhandle, wm_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey sendmessage(targetwinhandle, wm_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end else // not sendmsg fn if ime_msg // ime msg if widefunction // wide fn begin if simulatekey postmessagew(targetwinhandle, wm_ime_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); postmessagew(targetwinhandle, wm_ime_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey postmessagew(targetwinhandle, wm_ime_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end else // not wide fn begin if simulatekey postmessage(targetwinhandle, wm_ime_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); postmessage(targetwinhandle, wm_ime_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey postmessage(targetwinhandle, wm_ime_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end else // not ime msg if widefunction // wide fn begin if simulatekey postmessagew(targetwinhandle, wm_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); postmessagew(targetwinhandle, wm_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey postmessagew(targetwinhandle, wm_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end else begin if simulatekey postmessage(targetwinhandle, wm_keydown, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); postmessage(targetwinhandle, wm_char, makewparam(unicodevalue, 0), constructlparam(unicodevalue)); if simulatekey postmessage(targetwinhandle, wm_keyup, makewparam(unicodevalue, 0), (constructlparam(unicodevalue) or $c0000000)); end; end; { postcharacter }
but none of works in win64 (it use work fine under win32) :(
can please help, how post extended ascii chars (0x80 0xff) ?
thanks in advance
Comments
Post a Comment