Sorry if my question is previously answered here but I have, for days, searched the internet including SO with no solution.
Basically I want to Implement Download Manager for IE webbrowser control (Not IDE itself). I have read a lot on MSDN and among them is this link which shows how to create it. The Problem with this example (and my problem in that case) is where do I register/apply the IServiceProvider to my web browser. The Article does not say. However searching I found this question and it say I quote
Use CAxWindow::QueryHost to get IObjectWithSite pointer. Call SetSite passing your IServiceProvider implementation.
Unfortunately I don't use or know anything about ATL as I use wxWidgets. So where do I get that in wxWebview or "vanilla" MS COM?
here is what I have so far
HRESULT wxDownloadMgr::Download(IMoniker *pmk, IBindCtx *pbc,DWORD dwBindVerb,
LONG grfBINDF,BINDINFO *pBindInfo, LPCOLESTR pszHeaders,LPCOLESTR pszRedir,UINT uiCP )
{
// Get URL
LPOLESTR urlToFile;
HRESULT result = pmk->GetDisplayName( pbc, NULL, &urlToFile );
//OLECHAR is simply a wchar_t and an LPOLESTR is a wide character string (e.g. wchar_t*).
wxString url(urlToFile);
wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_DOWNLOAD_BEGINS,GetId(), url, "");
event.SetEventObject(this);//WHICH OBJECT TO SET HERE????????
HandleWindowEvent(event);
::MessageBox(NULL,"Download","Download Manager",MB_OK);
return S_OK;
}
STDMETHODIMP wxServiceProvider::QueryService(REFGUID guidService,
REFIID riid,
void **ppv)
{
HRESULT hr = E_NOINTERFACE;
if (guidService == SID_SDownloadManager && riid == IID_IDownloadManager)
{
// Create new DownloadMgr object using ATL.
CComObject<wxDownloadMgr>* pDownloadMgr;
hr = CComObject<wxDownloadMgr>::CreateInstance(&pDownloadMgr);
// Query the new CDownloadMgr object for IDownloadManager interface.
hr = pDownloadMgr->QueryInterface(IID_IDownloadManager, ppv);
}
return hr;
}