Click here to Skip to main content
15,890,186 members
Home / Discussions / COM
   

COM

 
GeneralRe: Automation error while creating a vc com dll object Pin
nikhil_ag19855-Jul-06 20:06
nikhil_ag19855-Jul-06 20:06 
QuestionDebug ActiveX control from C# application Pin
Maddie from Dartford3-Jul-06 21:11
Maddie from Dartford3-Jul-06 21:11 
QuestionHow DCOM is implemented? Pin
jayanthkulkarni3-Jul-06 2:21
jayanthkulkarni3-Jul-06 2:21 
AnswerRe: How DCOM is implemented? Pin
Mike Dimmick3-Jul-06 3:07
Mike Dimmick3-Jul-06 3:07 
QuestionHow to register a UPnP device Pin
Le Saint2-Jul-06 1:41
Le Saint2-Jul-06 1:41 
QuestionActiveX Question, help me. Pin
Shi Zhu29-Jun-06 23:18
Shi Zhu29-Jun-06 23:18 
AnswerRe: ActiveX Question, help me. Pin
peterchen8-Jul-06 5:33
peterchen8-Jul-06 5:33 
QuestionUsing MSHTML/CHtmlView in a thread Pin
Neville Franks29-Jun-06 16:31
Neville Franks29-Jun-06 16:31 
Hi,
I want to add content to a view derived from MFC's CHtmlView from a thread.
The following code is a stripped back version of the code executed by the
thread.

CMyHTMLView::AddHTML()
{
    HRESULT hr = CoInitialize( NULL );
    ASSERT( SUCCEEDED( hr ) );

    string shtml( "Hello World" );
    try
    {
        CComQIPtr< IHTMLDocument2 > pHtmlDoc( GetHtmlDocument() );
        if ( pHtmlDoc )
        {
            CComQIPtr< IHTMLElement > pBodyElement;
            HRESULT hr = pHtmlDoc->get_body( &pBodyElement );  //get body element
            if ( SUCCEEDED( hr ) )
                hr = pBodyElement->insertAdjacentHTML( _bstr_t(L"beforeEnd"), _bstr_t( shtml.c_str() ) );  // exception here to catch(...)
            ASSERT( SUCCEEDED( hr ) );
        }
    }
    catch( _com_error e )
    {
        REPORT_COM_ERROR(e);
    }
    catch(...)
    {
    }

    CoUninitialize();
}


If the contents of shtml is small as shown above it works fine. However when
shtml is a few K of HTML the call to insertAdjacentHTML() throws an
exception which is caught in catch(...). The HTML is valid and the same code
works fine when it isn't in a thread. In the real code, shtml is on the
heap or maybe the stack?

Any clues about what I'm doing wrong?

Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com
AnswerRe: Using MSHTML/CHtmlView in a thread Pin
Keith Worden30-Jun-06 1:04
Keith Worden30-Jun-06 1:04 
GeneralRe: Using MSHTML/CHtmlView in a thread Pin
Neville Franks30-Jun-06 1:38
Neville Franks30-Jun-06 1:38 
AnswerRe: Using MSHTML/CHtmlView in a thread Pin
peterchen8-Jul-06 5:37
peterchen8-Jul-06 5:37 
QuestionError registering dll Pin
Keith Worden29-Jun-06 7:33
Keith Worden29-Jun-06 7:33 
AnswerRe: Error registering dll Pin
Stephen Hewitt29-Jun-06 14:08
Stephen Hewitt29-Jun-06 14:08 
GeneralRe: Error registering dll Pin
Keith Worden30-Jun-06 0:19
Keith Worden30-Jun-06 0:19 
AnswerRe: Error registering dll Pin
Keith Worden30-Jun-06 0:54
Keith Worden30-Jun-06 0:54 
QuestionOutlook addin / paste clipboard content in message window Pin
Nicolas Richeton28-Jun-06 23:02
Nicolas Richeton28-Jun-06 23:02 
AnswerRe: Outlook addin / paste clipboard content in message window Pin
Nicolas Richeton29-Jun-06 4:59
Nicolas Richeton29-Jun-06 4:59 
QuestionIs COM supported on operating systems other than windows? Pin
Ajax9528-Jun-06 14:43
Ajax9528-Jun-06 14:43 
QuestionGetting Exception when two instance of ActiveX control are opened using Ctrl+N in IE Pin
Muhammad Azam28-Jun-06 4:10
Muhammad Azam28-Jun-06 4:10 
AnswerRe: Getting Exception when two instance of ActiveX control are opened using Ctrl+N in IE Pin
Mike Dimmick3-Jul-06 3:25
Mike Dimmick3-Jul-06 3:25 
GeneralRe: Getting Exception when two instance of ActiveX control are opened using Ctrl+N in IE Pin
Muhammad Azam4-Jul-06 23:21
Muhammad Azam4-Jul-06 23:21 
QuestionImporting and using an OCX Pin
Sean Capstick28-Jun-06 3:45
Sean Capstick28-Jun-06 3:45 
Questionchanges in idl file generated by an ocx [modified] Pin
nikhil_ag198528-Jun-06 0:31
nikhil_ag198528-Jun-06 0:31 
AnswerRe: changes in idl file generated by an ocx Pin
Mike Dimmick28-Jun-06 8:54
Mike Dimmick28-Jun-06 8:54 
GeneralRe: changes in idl file generated by an ocx Pin
nikhil_ag198528-Jun-06 15:24
nikhil_ag198528-Jun-06 15:24 

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.