Hi Chris,

In Delphi, all controls can be enabled or disabled including ActiveX controls. I'm not sure if this is a Delphi only thing or how to do it in C.

Dave Murray
Glasgow, UK
PGP KeyID: 0x838592B3

Remove NOSPAM from my email address to reply.





znakeeye wrote:
Uhm, exactly how do I disable/enable it? Is there a hidden function for that?
/Chris

irongut <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...

Disable the control beforehand and re-enable it afterwards.

Dave Murray
Glasgow, UK
PGP KeyID: 0x838592B3

Remove NOSPAM from my email address to reply.





znakeeye wrote:

Hi!

I really got thrilled when I saw this Mozilla ActiveX control.
Finally, my application does not need to have IE installed!
But... it turns out that a bug in IE:s ActiveX-control (that I
actually solved) exists in the Mozilla control too!

Try this (in C++):

// useful macro for checking HRESULTs
#define HRCHECK(x) hr = x; if (!SUCCEEDED(hr)) { \
        TRACE(_T("hr=%p\n"),hr);\
        return hr;\
}

// macro to declare a typedef for ATL smart poitners; eg
SPIHTMLDocument2
#define DECLARE_SMARTPTR(ifacename) typedef CComQIPtr<ifacename>
SP##ifacename;

// smart pointers
DECLARE_SMARTPTR(IHTMLDocument2)

HRESULT CHtmlViewEx::SetDocumentHtml(LPCTSTR strHTML)
{
     HRESULT hr;
     // Get document object
     SPIHTMLDocument2 doc = GetHtmlDocument();

     // Create string as one-element BSTR safe array for
IHTMLDocument2::write.
     CComSafeArray<VARIANT> sar;
     sar.Create(1, 0);
     sar[0] = CComBSTR(strHTML);

     // open doc and write
     LPDISPATCH lpdRet = NULL;     // Not assigned in Mozilla ActiveX
control!

     HRCHECK(doc->open(CComBSTR("text/html"),
           CComVariant(CComBSTR("_self")),
           CComVariant(CComBSTR("")),
           CComVariant(true),
           &lpdRet));

     HWND hFocus = ::GetFocus();   // My IE "steal focus" workaround
;-)

     HRCHECK(doc->write(sar));     // write contents to doc
     HRCHECK(doc->close());        // close

     if (lpdRet)
           lpdRet->Release();      // release IDispatch returned

     ::SetFocus(hFocus);           // Steal back the focus! This
works in IE!

     return S_OK;
}

The Mozilla ActiveX control will steal the focus as soon as it sets
the html! Frustrating!

Best regards,
Chris, Sweden
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to