keybd_event lazarus / 21-General ---------------------------------------------------------------------- Ed78z · 2025-07-03 23:31 Hello, I can't find a solution to simulate keyboard in case of more than two keys combination. For example, simulating of WIN+SHIFT+UP_arrow Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Uses Windows; Procedure MaximizeWindowVertically;begin  keybd_event(VK_LWIN, 0, 0, 0); // Left Windows key down  keybd_event(VK_SHIFT, 0, 0, 0); // Shift key down  keybd_event(VK_UP, 0, 0, 0); // Up arrow key down   keybd_event(VK_UP, 0, KEYEVENTF_KEYUP, 0); // Up arrow key up  keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); // Shift key up  keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0); // Left Windows key upend;  This code doesn't work! it just simulating WIN+UP_arrow (two keys) Do you have any idea how to simulate three keys combination? ---------------------------------------------------------------------- jamie · 2025-07-03 23:51 Use this instead. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf- winuser-sendinput  jamie ---------------------------------------------------------------------- Fibonacci · 2025-07-04 00:11 Quote from: jamie on July 04, 2025, 01:51:32 amUse this instead. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf- winuser-sendinput  jamie Same side effect: the start menu pops up as if WIN+SHIFT was pressed, but it also works and maximizes the window vertically. But MoveWindow() can do the job. GPT-generated code. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses JwaWindows{for MONITORINFO}, Windows; procedure MaximizeVertically;var  mi: MONITORINFO;  rc: TRect;  h: HWND;begin  h := GetForegroundWindow;  mi.cbSize := SizeOf(mi);  GetMonitorInfo(MonitorFromWindow(h, MONITOR_DEFAULTTONEAREST), @mi);  GetWindowRect(h, rc);  MoveWindow(h,    rc.Left,    mi.rcWork.Top,    rc.Right - rc.Left,    mi.rcWork.Bottom - mi.rcWork.Top,    True);end; begin  writeln('testing in 1s...');  sleep(1000);   MaximizeVertically;   writeln('worked?');  readln;end. ---------------------------------------------------------------------- Thaddy · 2025-07-04 15:13 What is wrong with the shortcut editor? (nothing) Define an action first and call that. That's also cross platform instead of the windows keybd_event stuff. ---------------------------------------------------------------------- n7800 · 2025-07-05 12:46 Quote from: Ed78z on July 04, 2025, 01:31:41 amThis code doesn't work! it just simulating WIN+UP_arrow (two keys) Do you have any idea how to simulate three keys combination? Add the KEYEVENTF_EXTENDEDKEY flag. Unfortunately, the description of this flag is unclear, and I don't know when it is needed. But at least it helped. ---------------------------------------------------------------------- n7800 · 2025-07-05 12:52 Of course, some information can be found on the Internet. For example, here keybd_event is even mentioned. ---------------------------------------------------------------------- Thaddy · 2025-07-05 13:59 Quote from: n7800 on July 05, 2025, 02:52:52 pmOf course, some information can be found on the Internet. For example, here keybd_event is even mentioned. In the context of winapi, duh... Lazarus only support that on windows because it is windows specific.