D
dsideal
Unregistered / Unconfirmed
GUEST, unregistred user!
LiChaoHui 你好,上几天你帮助我解决了Web控件的滚动事件,但是他只有onscroll事件,我是不是换成其他的如:onmousedown就可以捕获到鼠标事件了呢?请赐教。我用另一个方法获取了鼠标事件,但是退出的时候出现错误提示。我捕获鼠标事件代码如下:
//启动监测鼠标事件
procedure TForm1.Button3Click(Sender: TObject);
begin
IEHandle := findWindowEx(WB_Des.Handle, 0, 'Shell DocObject View', nil);
IEHandle := findWindowEx(IEHandle, 0, 'Internet Explorer_Server', nil);
FClientInstance := MakeObjectInstance(ClientWndProc);
FPrevClientProc := Pointer(GetWindowLong(IEHandle, GWL_WNDPROC));
SetWindowLong(IEHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TForm1.ClientWndProc(var Message: TMessage);
var
Pos_Sou:TPoint;
begin
with Message do
case Msg of
WM_KeyDown:
begin
ShowMessage('WM KeyDown');
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
WM_LBUTTONDOWN:
begin
ShowMessage('WM Mouse Left Button Down');
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
WM_MOUSEMOVE:
begin
GetCursorPos(Pos_Sou);
Form1.Caption :=IntToStr(Pos_Sou.X)+','+IntToStr(Pos_Sou.Y);
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
WM_VSCROLL:
begin
ShowMessage('asdf');
end;
WM_QUIT:
begin
ShowMessage('111');
end;
else
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
end;
我下面的程序可以获得鼠标事件,但是没有滚动事件。你给我的程序有滚动事件,但没有鼠标事件。两个消息一起捕获在程序退出的时候在我的程序最后一句:else
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
处出现错误提示:access violation at 0x004583 read of address ....我想是不是消息冲突了。请帮帮忙分析一下好么?
//启动监测鼠标事件
procedure TForm1.Button3Click(Sender: TObject);
begin
IEHandle := findWindowEx(WB_Des.Handle, 0, 'Shell DocObject View', nil);
IEHandle := findWindowEx(IEHandle, 0, 'Internet Explorer_Server', nil);
FClientInstance := MakeObjectInstance(ClientWndProc);
FPrevClientProc := Pointer(GetWindowLong(IEHandle, GWL_WNDPROC));
SetWindowLong(IEHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TForm1.ClientWndProc(var Message: TMessage);
var
Pos_Sou:TPoint;
begin
with Message do
case Msg of
WM_KeyDown:
begin
ShowMessage('WM KeyDown');
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
WM_LBUTTONDOWN:
begin
ShowMessage('WM Mouse Left Button Down');
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
WM_MOUSEMOVE:
begin
GetCursorPos(Pos_Sou);
Form1.Caption :=IntToStr(Pos_Sou.X)+','+IntToStr(Pos_Sou.Y);
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
WM_VSCROLL:
begin
ShowMessage('asdf');
end;
WM_QUIT:
begin
ShowMessage('111');
end;
else
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
end;
end;
我下面的程序可以获得鼠标事件,但是没有滚动事件。你给我的程序有滚动事件,但没有鼠标事件。两个消息一起捕获在程序退出的时候在我的程序最后一句:else
Result := CallWindowProc(FPrevClientProc, IEHandle, Msg, wParam, lParam);
处出现错误提示:access violation at 0x004583 read of address ....我想是不是消息冲突了。请帮帮忙分析一下好么?