Click here to Skip to main content
16,004,898 members
Home / Discussions / COM
   

COM

 
AnswerRe: VB6 - C# interop. Returning an arrays. MarshalAs? Pin
Baltoro12-Jun-08 6:51
Baltoro12-Jun-08 6:51 
GeneralRe: VB6 - C# interop. Returning an arrays. MarshalAs? Pin
Simon P Stevens12-Jun-08 10:57
Simon P Stevens12-Jun-08 10:57 
QuestionDirectShow video capture and play back synchronisation problem Pin
ak$12345-Jun-08 22:04
ak$12345-Jun-08 22:04 
AnswerRe: DirectShow video capture and play back synchronisation problem Pin
stuart151-Sep-08 0:00
stuart151-Sep-08 0:00 
QuestionLaunching multiple IE [modified] Pin
Nirav Doshi5-Jun-08 8:19
Nirav Doshi5-Jun-08 8:19 
AnswerRe: Launching multiple IE Pin
Nirav Doshi5-Jun-08 10:11
Nirav Doshi5-Jun-08 10:11 
QuestionRe: Launching multiple IE [modified] Pin
Nirav Doshi12-Jun-08 18:04
Nirav Doshi12-Jun-08 18:04 
AnswerRe: Launching multiple IE Pin
Nirav Doshi14-Jun-08 0:10
Nirav Doshi14-Jun-08 0:10 
Finally, a good friend (Nanda) was able to help with this, and got the code below WORKING! This is how to get IWebBrowser2 from IHTMLDocument2.

Pasting code below for anyone who may need this. I had a very tough week wrestling with this, don't want anyone else to go through the same. Smile | :)

CComQIPtr<IOleObject>  spOleObject;			// IOleObject
CComQIPtr<IOleClientSite> spOleClientSite;		// IOleClientSite
CComQIPtr<IServiceProvider> spServiceProvider;		// IServiceProvider
...
...  // Code here as per <a href="http://support.microsoft.com/kb/q249232/">How to get IHTMLDocument2 from a HWND</a>[<a href="http://support.microsoft.com/kb/q249232/" target="_blank" title="New Window">^</a>]
...
HRESULT hRes = spHTMLDoc2->QueryInterface(IID_IOleObject, reinterpret_cast<void **>(&spOleObject));
if (SUCCEEDED(hRes))
{
	hRes = spOleObject->GetClientSite(&spOleClientSite);
	if(SUCCEEDED(hRes))
	{
		hRes = spOleClientSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&spServiceProvider));
		if(SUCCEEDED(hRes))
		{
			hRes = spServiceProvider->QueryService(SID_SWebBrowserApp,IID_IWebBrowser2, reinterpret_cast<void **>(&spWebBrowser));
		}
		if(SUCCEEDED(hRes))
		{
			BSTR oURL;
			oURL = SysAllocString(L"http://www.google.com");
			VARIANT var;
			var.vt = VT_EMPTY;

			spWebBrowser->Navigate((BSTR)oURL, &var, &var, &var, &var);
			SysFreeString(oURL);
		}
	}
}


Thanks a ton Nanda! Cool | :cool:

* Blood donation is the superior'est form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

AnswerRe: Launching multiple IE Pin
Michael Dunn12-Jun-08 14:45
sitebuilderMichael Dunn12-Jun-08 14:45 
GeneralRe: Launching multiple IE Pin
Nirav Doshi13-Jun-08 8:19
Nirav Doshi13-Jun-08 8:19 
AnswerRe: Launching multiple IE Pin
Jörgen Sigvardsson13-Jun-08 10:49
Jörgen Sigvardsson13-Jun-08 10:49 
GeneralRe: Launching multiple IE Pin
Nirav Doshi13-Jun-08 20:14
Nirav Doshi13-Jun-08 20:14 
GeneralRe: Launching multiple IE Pin
Jörgen Sigvardsson13-Jun-08 22:14
Jörgen Sigvardsson13-Jun-08 22:14 
GeneralRe: Launching multiple IE Pin
Nirav Doshi14-Jun-08 2:06
Nirav Doshi14-Jun-08 2:06 
QuestionDetect Network Adapters in Borland C++ Builder Pin
Nekt Chrono4-Jun-08 21:54
Nekt Chrono4-Jun-08 21:54 
QuestionExcel WorkbookBeforeClose event Document Proof Pin
HarishKumarS4-Jun-08 4:37
HarishKumarS4-Jun-08 4:37 
Questionpass a parameter to a com+ application Pin
Ayman Mashal4-Jun-08 0:19
Ayman Mashal4-Jun-08 0:19 
QuestionCOM and Inteface/Implementation Polymorphism Pin
kimutley3-Jun-08 10:02
kimutley3-Jun-08 10:02 
Questionc# delegates and effect on c++ com server Pin
dtranter3-Jun-08 1:06
dtranter3-Jun-08 1:06 
QuestionGetting the Physical File Name of a Spreadsheet Pin
Brendan Vogt2-Jun-08 1:06
Brendan Vogt2-Jun-08 1:06 
AnswerRe: Getting the Physical File Name of a Spreadsheet Pin
Vi26-Jun-08 0:24
Vi26-Jun-08 0:24 
QuestiondirectX with webcam Property Pin
mmvv2-Jun-08 0:06
mmvv2-Jun-08 0:06 
QuestionCoInitialize permissions for windows service Pin
rana741-Jun-08 19:12
rana741-Jun-08 19:12 
AnswerRe: CoInitialize permissions for windows service Pin
rana742-Jun-08 16:04
rana742-Jun-08 16:04 
GeneralRe: CoInitialize permissions for windows service Pin
vipin.vjayan6-Oct-20 4:04
vipin.vjayan6-Oct-20 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.