Click here to Skip to main content
15,911,646 members
Home / Discussions / COM
   

COM

 
AnswerRe: COM Wrapper Pin
User 21559729-Nov-06 4:53
User 21559729-Nov-06 4:53 
GeneralRe: COM Wrapper Pin
sheetal_0629-Nov-06 17:58
sheetal_0629-Nov-06 17:58 
QuestionActiveX Control Pin
HakunaMatada27-Nov-06 17:04
HakunaMatada27-Nov-06 17:04 
AnswerRe: ActiveX Control Pin
Roger Stoltz27-Nov-06 20:55
Roger Stoltz27-Nov-06 20:55 
GeneralRe: ActiveX Control Pin
HakunaMatada27-Nov-06 21:29
HakunaMatada27-Nov-06 21:29 
GeneralRe: ActiveX Control Pin
Roger Stoltz27-Nov-06 21:49
Roger Stoltz27-Nov-06 21:49 
QuestionWMI Pin
abhiramsss27-Nov-06 9:38
abhiramsss27-Nov-06 9:38 
QuestionUnhandled Exception in Popup blocker code Pin
georgekjolly25-Nov-06 3:56
georgekjolly25-Nov-06 3:56 
Hi all ,

I have just started doing COM , I have Written a Code for popup

blocker(I have given it below) .

Whenever a new popup comes the control will call Invoke Method

and goes inside "case DISPID_NEWWINDOW2" and execute


pdispparams->rgvarg[0].pvarVal->vt = VT_BOOL;
pdispparams->rgvarg[0].pvarVal->boolVal = VARIANT_TRUE;

these codes but after this an unhandled exception is coming and I am unable to

do something on it . why it is coming and is there any problem with my code.

I have given all the codes in Implementation file below . Please help me


/////////Code starts here//////////////////


CComQIPtr<iwebbrowser2, &iid_iwebbrowser2=""> m_spWebBrowser2;
CComQIPtr<iconnectionpointcontainer,
="" &iid_iconnectionpointcontainer=""> m_spCPC;


IConnectionPointContainer* connectionPointContainer;


STDMETHODIMP CMyBhoExp::SetSite(IUnknown* pUnkSite)
{

m_spWebBrowser2 = pUnkSite;

if (m_spWebBrowser2 == NULL)
return E_INVALIDARG;

// Retrieve and store the IConnectionPointerContainer pointer
m_spCPC = m_spWebBrowser2;
if (m_spCPC == NULL)
return E_POINTER;

// Retrieve and store the HWND of the browser. Plus install
// a keyboard hook for further use
//RetrieveBrowserWindow();

// Connect to the container for receiving event notifications
return Connect();
//return hr;
}


STDMETHODIMP CMyBhoExp::GetSite(REFIID riid, void **ppvSite)
{
HRESULT hr;
return hr;

}


HRESULT CMyBhoExp::Connect(void)
{
HRESULT hr;
DWORD m_dwCookie;
CComPtr<iconnectionpoint> spCP;

// Receives the connection point for WebBrowser events
hr = m_spCPC->FindConnectionPoint(DIID_DWebBrowserEvents2, &spCP);
if (FAILED(hr))
return hr;

// Pass our event handlers to the container. Each time an event occurs
// the container will invoke the functions of the IDispatch interface
// we implemented.
hr = spCP->Advise( reinterpret_cast<idispatch*>(this), &m_dwCookie);
return hr;
}

HRESULT CMyBhoExp::Invoke(DISPID dispidMember,REFIID riid, LCID lcid, WORD wFlags,DISPPARAMS * pdispparams, VARIANT * pvarResult,EXCEPINFO * pexcepinfo, UINT * puArgErr)
{
switch(dispidMember)
{
//Pop up blocker
case DISPID_NEWWINDOW2:

TRACE("Pop Up Blocked");

pdispparams->rgvarg[0].pvarVal->vt = VT_BOOL;
pdispparams->rgvarg[0].pvarVal->boolVal = VARIANT_TRUE;


break;

case DISPID_DOCUMENTCOMPLETE:
TRACE("\ncase DISPID_DOCUMENTCOMPLETE:");
break;
}
return S_OK;
}

//////////////////////Code ends here////////////////////////

Thanks
George
QuestionIE window manipulation using web browser object Pin
georgekjolly25-Nov-06 2:22
georgekjolly25-Nov-06 2:22 
QuestionAccess Violation occur when use goForward() or goBack() method in IWebBrowser2 Pin
Lee bo24-Nov-06 3:30
Lee bo24-Nov-06 3:30 
AnswerRe: Access Violation occur when use goForward() or goBack() method in IWebBrowser2 Pin
Roger Stoltz24-Nov-06 4:55
Roger Stoltz24-Nov-06 4:55 
QuestionAdding function to interface. Pin
Suresh H22-Nov-06 18:15
Suresh H22-Nov-06 18:15 
QuestionHow can i call C# interface function from C++ ( visual 6 ) application ? Pin
Yanshof22-Nov-06 0:55
Yanshof22-Nov-06 0:55 
AnswerRe: How can i call C# interface function from C++ ( visual 6 ) application ? Pin
ThatsAlok3-Dec-06 19:33
ThatsAlok3-Dec-06 19:33 
QuestionHow do you implement an Event Sink without a Type Library? Pin
Bathory's Curse21-Nov-06 7:01
Bathory's Curse21-Nov-06 7:01 
AnswerRe: How do you implement an Event Sink without a Type Library? Pin
Stephen Hewitt21-Nov-06 11:50
Stephen Hewitt21-Nov-06 11:50 
GeneralRe: How do you implement an Event Sink without a Type Library? Pin
Bathory's Curse21-Nov-06 13:44
Bathory's Curse21-Nov-06 13:44 
GeneralRe: How do you implement an Event Sink without a Type Library? Pin
Stephen Hewitt21-Nov-06 14:38
Stephen Hewitt21-Nov-06 14:38 
GeneralRe: How do you implement an Event Sink without a Type Library? Pin
Bathory's Curse22-Nov-06 10:05
Bathory's Curse22-Nov-06 10:05 
Questionhow to know the name of dll? Pin
kalaveer21-Nov-06 1:05
kalaveer21-Nov-06 1:05 
QuestionCom exe and dll Pin
ashokvishnu20-Nov-06 16:42
ashokvishnu20-Nov-06 16:42 
AnswerRe: Com exe and dll Pin
Roger Stoltz20-Nov-06 21:43
Roger Stoltz20-Nov-06 21:43 
QuestionPorting D/COM OLE Server from W2K to WXP : Issues Pin
sebastien_pelle20-Nov-06 5:29
sebastien_pelle20-Nov-06 5:29 
QuestionConvert pdf to tiff Pin
Dudi Avramov20-Nov-06 3:57
Dudi Avramov20-Nov-06 3:57 
QuestionNewWIndow2 Event Sink problem Pin
yokos117-Nov-06 12:26
yokos117-Nov-06 12:26 

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.