[Solved] How to disable Mouse and Keyboard events in ownership state? lazarus / 34-Windows ---------------------------------------------------------------------- loaded · 2022-03-21 08:08 Hi All, 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 function SetParent(hWndChild:HWND; hWndNewParent:HWND):HWND; external 'user32' name 'SetParent'; Can we stop the mouse and keyboard events coming to the application that we take ownership of and embed in our own form with the command ? ---------------------------------------------------------------------- balazsszekely · 2022-03-21 08:59 @loaded QuoteCan we stop the mouse and keyboard events coming to the application that we take ownership of and embed in our own form with the command ?Create a low level mouse hook. I did something similar here: https://forum.lazarus.freepascal.org/index.php/topic,28963.msg18 2081.html#msg182081 Just replace taskbar handle with hWndChild, which is the embedded form's handle. If you wish to completely stop mouse event(s), set the hook result to -1 and immediately exit, something like this: 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 function LowLevelMouseHook(nCode: Integer; wParam: WPARAM; lParam: LPARAM): HRESULT; stdcall;var  pmsll: PtagMSLLHookStruct;  pt: TPOINT;  Rect: TRECT;begin  pmsll := PtagMSLLHookStruct(Pointer(lParam));  if nCode = HC_ACTION then  begin    if wParam = WM_MOUSEMOVE then //set here the event you wish to prevent    begin      pt := pmsll^.pt;      if IsMouseOverEmbeddedForm(pt) then      begin                Result := -1; //stop mouse event to propagate further         Exit;      end;  end;  end;  Result := CallNextHookEx(llMouseHook, nCode, wParam, lParam);end; You can do the same with the keyboard. Just do a quick forum search, I posted similar code in the past. ---------------------------------------------------------------------- loaded · 2022-03-21 11:44 Thank you very much for your answer, my dear master GetMem. I tried your suggestion, but was not successful. Meanwhile, I tried another method that came to my mind; I uploaded the external application to the Panel control from my own form, then I solved the problem by disabling the enabled feature. ---------------------------------------------------------------------- balazsszekely · 2022-03-21 13:24 @loaded QuoteI uploaded the external application to the Panel control from my own form, then I solved the problem by disabling the enabled feature.You're absolutely right, I overthought this one.