关键字:IWebBrowser2,HWND,::GetCursorPos,::ScreenToClient
方法:
HRESULT IWebBrowser2::get_HWND(long *pHWND);
代码:
#include <shlguid.h>IServiceProvider* pServiceProvider = NULL;
if (SUCCEEDED(pWebBrowser2->QueryInterface(
IID_IServiceProvider,
(void**)&pServiceProvider)))
{
IOleWindow* pWindow = NULL;
if (SUCCEEDED(pServiceProvider->QueryService(
SID_SShellBrowser,
IID_IOleWindow,
(void**)&pWindow)))
{
HWND hwndBrowser = NULL;
if (SUCCEEDED(pWindow->GetWindow(&hwndBrowser)))
{
// hwndBrowser is the handle of TabWindowClass
}
pWindow->Release();
}
pServiceProvider->Release();
}
参考:http://msdn.microsoft.com/en-us/library/aa752126.aspx
http://topic.csdn.net/u/20070301/11/91d45328-4985-4a16-8ccf-b58b2423e8a2.html