delphiemojidelphi-12-athenswindows-key

Programmatically show the Windows Emoji Panel?


On Windows 10/11 the Windows Emoji Panel can be invoked by pressing the keys WIN+. (Windows key + period key)

I tried to simulate the pressing of these keys:

procedure ShowEmojiPanel;
var
  Inputs: array[0..3] of TInput;
begin
  // Simulate pressing the Windows Key
  ZeroMemory(@Inputs, SizeOf(Inputs));
  Inputs[0].Itype := INPUT_KEYBOARD;
  Inputs[0].ki.wVk := VK_LWIN;

  // Simulate pressing the '.' key
  Inputs[1].Itype := INPUT_KEYBOARD;
  Inputs[1].ki.wVk := Ord('.');

  // Simulate releasing the '.' key
  Inputs[2].Itype := INPUT_KEYBOARD;
  Inputs[2].ki.wVk := Ord('.');
  Inputs[2].ki.dwFlags := KEYEVENTF_KEYUP;

  // Simulate releasing the Windows Key
  Inputs[3].Itype := INPUT_KEYBOARD;
  Inputs[3].ki.wVk := VK_LWIN;
  Inputs[3].ki.dwFlags := KEYEVENTF_KEYUP;

  // Send the inputs
  SendInput(4, Inputs[0], SizeOf(TInput));
end;

procedure ShowEmojiPanel;
begin
  // Press WIN key
  keybd_event(VK_LWIN, 0, 0, 0);

  // Press period (.)
  keybd_event(Ord('.'), 0, 0, 0);

  // Release period (.)
  keybd_event(Ord('.'), 0, KEYEVENTF_KEYUP, 0);

  // Release WIN key
  keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
end;

However, it seems that none of these procedures is able to open the Windows Emoji Panel on my Windows 11.

Is there another way to programmatically show the Windows Emoji Panel?


Solution

  • Your SendInput approach should work if you specify VK_OEM_PERIOD instead of Ord('.').