在DCEF 1(Delphi Chromium Embedded 1)中,我使用TChromium.Browser.SetFocus(True);
来设置浏览器窗口的焦点,但在DCEF 3中,我找不到设置此窗口焦点的方法。
有谁知道如何在DCEF 3中设置TChromium
浏览器窗口的焦点?
感谢 TLama
function CefWndProc(Wnd: HWND; message: UINT; wParam: Integer; lParam: Integer): Integer; stdcall;
begin
case message of
WM_SETFOCUS:
begin
if brows <> nil then
PostMessage(brows.Host.WindowHandle, WM_SETFOCUS, wParam, 0);
Result := 0;
end;
//...
else
result := DefWindowProc(Wnd, message, wParam, lParam);
end;
end;
//MyChromium.Browser.Host.SetFocus(true);
procedure TWinControl.SetFocus;
TCustomChromium = class(TWinControl, IChromiumEvents)
TChromium
是TWinControl。