2009. április 15., szerda

Block mouse clicks to a specific window

Problem/Question/Abstract:

I need to create an invisible window over a webbrowser component so that I can stop mouse clicks.

Answer:

There are much better ways to block mouse clicks to a specific window. You can use a handler for the Application.OnMessage event, for example:

procedure TMainform.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppOnMessage;
end;

procedure TMainform.AppOnMessage(var Msg: TMsg; var Handled: Boolean);
begin
case Msg.Message of
WM_MOUSEFIRST..WM_MOUSELAST, WM_MOUSEWHEEL:
if Msg.hwnd = Webbrowser1.HWND then
Handled := True;
end;
end;


Nincsenek megjegyzések:

Megjegyzés küldése