How do I send CM_/CN_ messages to controls in a cross-platform manner? [SOLVED] lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- carl_caulkett · 2024-09-29 20:39 * Mac Mini M1 * macOS 14.6.1 * Lazarus 3.4 * FPC 3.2.2 Back in my Delphi days, if I wanted to send messages to a control, I would use the WM_ Windows messages and send them to a control's Handle. Presumably on the Mac this is a non-starter! However, I've just found TRon's excellent post https://forum.lazarus.freepascal.org/index.php/t opic,63350.msg479697.html#msg479697 which shows how to use the TApplicationProperties component to intercept messages such as CN_KEYDOWN and CN_KEYUP, received on any control in my app. This, then, begs the question, is it possible to send similar messages to a control of my choosing, and will this work equally on Mac, Linux and Windows? ---------------------------------------------------------------------- carl_caulkett · 2024-09-29 21:53 The reason I wanted to send messages to a control was tied up with my problem with macOS insisting on beeping on unhandled keyboard inputs. I managed to mitigate the problem to some extent by holding my TLazVirtualStringTree in a dummy TPageControl which certainly suppressed the beeping on cursor up and down keystrokes. But the beeping returned when I tried to use the LazMouseAndKeyInput.lpk package... 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 procedure TMain.PresetTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);var  I: Integer;begin  case Key of    VK_PRIOR:      for I := 1 to PresetTreeRowsPerPage do        KeyInput.Press(VK_UP);    VK_NEXT:      for I := 1 to PresetTreeRowsPerPage do        KeyInput.Press(VK_DOWN);  end;  case Key of    VK_PRIOR, VK_NEXT, VK_HOME, VK_END:      Key := 0;  end;end;  I eventually solved this problem by changing the macOS settings for Sound. All I had to do was to select a destination for "Play sound effects through" that didn't go to a speaker or an audio interface and the beeping vanished, which meant that I could get rid of all of the above malarkey