首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

鼠标滚轮消息,对Memo控件有效果。对webbrowser控件没效果,帮个忙试试!该怎么处理

2012-03-08 
鼠标滚轮消息,对Memo控件有效果。对webbrowser控件没效果,帮个忙试试!这代码很多人需要吧,网上很难找。虽然w

鼠标滚轮消息,对Memo控件有效果。对webbrowser控件没效果,帮个忙试试!
这代码很多人需要吧,网上很难找。
虽然webbrowser不起效,其它控件还是有用的。谁帮试试!

Delphi(Pascal) code
function TForm1.GetHwnd(AHwnd:THandle):THandle;begin  //Result := FindWindowEx(ParentHwnd, 0,'Shell Embedding', nil);  Result := FindWindowEx(AHwnd, 0,'Shell DocObject View', nil);  Result := FindWindowEx(Result, 0,'Internet Explorer_Server', nil);end;procedure TForm1.Button1Click(Sender: TObject);begin  SendMessage(GetHwnd(EmbeddedWB1.Handle), WM_MOUSEWHEEL, (-120*3) shl 16, (5 shl 16) or 5);//失败  //SendMessage(Memo1.Handle), WM_MOUSEWHEEL, (-120*3) shl 16, (5 shl 16) or 5);//成功end;


[解决办法]
IHTMLWindow2(IHTMLDocument2(WebBrowser1.Document).ParentWindow).Focus;
IHTMLWindow2(IHTMLDocument2(WebBrowser1.Document).ParentWindow).scroll(100,100);

用这个吧,效果一样的,直接鼠标消息那个我也没做出来,放弃了,呵呵

热点排行