2

I am writing a Global Hook Procedure. Using SendInput to send ascii ( < 255 ) and Unicode characters. So far it is working well. But in my language, Tamil there are some characters that are combination characters which do not have Unicode code points. So in fonts there are glyphs defined above 255. How do I send virtual key codes for them?
Though those glyphs do not have code points they have glyph names like u0BAF_u0BBF. the first and second part are defined in Unicode. These names are referred as named sequence and approved by Unicode.
Code:

procedure GenUKey(const vk: integer;  const bUnicode: bool);
var
  kb: TKEYBDINPUT;
  Input: TINPUT;
begin
{keydown}
{  ZeroMemory(@kb,sizeof(kb));}
{  ZeroMemory(@input,sizeof(input));}

{keydown}
  if bUnicode then
  begin
    kb.wVk:= 0;
    kb.wScan:= vk; ;
    kb.dwFlags:= $4;
{ KEYEVENTF_UNICODE=4}
  end
  else
  begin
    kb.wVk:= vk;
    kb.wScan:= 0; ;
    kb.dwFlags:= 0;
  end;
  Input.itype:= INPUT_KEYBOARD;
  Input.ki:= kb;

  SendInput(1, Input,sizeof(Input));

{keyup}
  if bUnicode then
  begin
    kb.wVk:= 0;
    kb.wScan:= vk ;
    kb.dwFlags:= $4 or KEYEVENTF_KEYUP;
{KEYEVENTF_UNICODE=4}
  end
  else
  begin
    kb.wVk:= vk;
    kb.wScan:= 0;
    kb.dwFlags:= KEYEVENTF_KEYUP;
  end;
  Input.itype:= INPUT_KEYBOARD;
  Input.ki:= kb;

  SendInput(1,Input,sizeof(Input));
end;

Edit: Yes, I do send each code point individually. There are glyphs attached to each code point. Also there is another one combining the design of both. It looks better visually and behaves as one character. As it is defined separately I thought there should be a way to send by using sendinput.
Edit2:
Also there are some characters that can not be combined mechanically.
Edit 3: Tests prove that Rob Kennedy is correct. The second code point is not displayed mechanically. It is intelligently combined with the first one to get a third new combined glyph. The glyph (name) encoding is used. My code to do the same programmatically has interfered in this process and hence the problem.
Many Thanks

sridharxp
  • 21
  • 2

0 Answers0