Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Bug 72320: SWT Fails to load ActiveX control with error -2147467262
Bug 72320: SWT Fails to load ActiveX control with error -2147467262 [message #443367] Thu, 23 September 2004 19:56 Go to next message
Fan Yang is currently offline Fan YangFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I just figured out that this is not a bug of the eclipse SWT. Actually it's
that control itself(DSOFramerControl which can be found on MSDN) dosen't
implement minimum required interfaces, in consequence it can't be
instantiated by win32 API OleCreate.

Older "OLE object" specifications require the implementation of IOleObject,
IDataObject and IPersistStorage as the mimimal set of interfaces to qualify
a blob as an OLE object. To workaround, you must implement the missing
interface as what I did, and it works fine.

Fan Yang

OSTnet Inc.
Re: Bug 72320: SWT Fails to load ActiveX control with error -2147467262 [message #443455 is a reply to message #443367] Fri, 24 September 2004 17:18 Go to previous messageGo to next message
Kenzo is currently offline KenzoFriend
Messages: 13
Registered: July 2009
Junior Member
Well done! Any chance you can share the patched C++ code?

"fan" <fan@ostnet.com> wrote in message news:civ903$irl$1@eclipse.org...
> Hi,
>
> I just figured out that this is not a bug of the eclipse SWT. Actually
it's
> that control itself(DSOFramerControl which can be found on MSDN) dosen't
> implement minimum required interfaces, in consequence it can't be
> instantiated by win32 API OleCreate.
>
> Older "OLE object" specifications require the implementation of
IOleObject,
> IDataObject and IPersistStorage as the mimimal set of interfaces to
qualify
> a blob as an OLE object. To workaround, you must implement the missing
> interface as what I did, and it works fine.
>
> Fan Yang
>
> OSTnet Inc.
>
>
Re: Bug 72320: SWT Fails to load ActiveX control with error -2147467262 [message #443462 is a reply to message #443367] Fri, 24 September 2004 19:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dwojtas.myrealbox.com

fan wrote:
> Hi,
>
> I just figured out that this is not a bug of the eclipse SWT. Actually it's
> that control itself(DSOFramerControl which can be found on MSDN) dosen't
> implement minimum required interfaces, in consequence it can't be
> instantiated by win32 API OleCreate.
>
> Older "OLE object" specifications require the implementation of IOleObject,
> IDataObject and IPersistStorage as the mimimal set of interfaces to qualify
> a blob as an OLE object. To workaround, you must implement the missing
> interface as what I did, and it works fine.
>
> Fan Yang
>
> OSTnet Inc.

Can you place somewhere your modified version?
Or send me by email?

Darek
Re: Bug 72320: SWT Fails to load ActiveX control with error -2147467262 [message #443553 is a reply to message #443462] Tue, 28 September 2004 07:16 Go to previous messageGo to next message
Richard Moore is currently offline Richard MooreFriend
Messages: 71
Registered: July 2009
Member
Hi,

We would also be interested in the patch, could you email it or publish it
on the group.

Cheers
R Moore

"Dariusz Wojtas" <dwojtas@myrealbox.com> wrote in message
news:cj1trt$18u$1@eclipse.org...
> fan wrote:
>> Hi,
>>
>> I just figured out that this is not a bug of the eclipse SWT. Actually
>> it's
>> that control itself(DSOFramerControl which can be found on MSDN) dosen't
>> implement minimum required interfaces, in consequence it can't be
>> instantiated by win32 API OleCreate.
>>
>> Older "OLE object" specifications require the implementation of
>> IOleObject,
>> IDataObject and IPersistStorage as the mimimal set of interfaces to
>> qualify
>> a blob as an OLE object. To workaround, you must implement the missing
>> interface as what I did, and it works fine.
>>
>> Fan Yang
>>
>> OSTnet Inc.
>
> Can you place somewhere your modified version?
> Or send me by email?
>
> Darek
Re: Bug 72320: SWT Fails to load ActiveX control with error -2147467262 [message #444054 is a reply to message #443553] Tue, 05 October 2004 22:39 Go to previous messageGo to next message
Fan Yang is currently offline Fan YangFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

Sorry for late response because I'm working on another project and didn't
visit swt newsgroup for a while.

I have to say that I'm not a COM expert, so the solution maybe not perfect,
it's just for your reference. If you find errors or another good solution,
please let me know. thanks.

By the way, actually I rewrote the CDsoFramerControl(ActiveX control) by
using ATL and kept the CDsoDocObject(ActiveX document container), in that
way, I have integrate our system(COM based) with eclipse, and it works fine.

//Step 1. Add following code to dsoframer.h
// IPersistStorage
BEGIN_INTERFACE_PART(PersistStorage, IPersistStorage)
STDMETHODIMP GetClassID(CLSID *pClassID);
STDMETHODIMP IsDirty(void);
STDMETHODIMP Load(IStorage * pStg);
STDMETHODIMP Save(IStorage * pStgSave, BOOL fSameAsLoad);
STDMETHODIMP SaveCompleted(IStorage * pStgNew);
STDMETHODIMP HandsOffStorage(void);
STDMETHODIMP InitNew(IStorage* pStg);
END_INTERFACE_PART(PersistStorage)

//Step 2. add following code to dsofcontrol.cpp
//////////////////////////////////////////////////////////// ////////////
// CDsoFramerControl::XPersistStorage -- IPersistStorage Implementation
// STDMETHODIMP GetClassID(CLSID *pClassID);
// STDMETHODIMP IsDirty(void);
// STDMETHODIMP Load(IStorage * pStg);
// STDMETHODIMP Save(IStorage * pStgSave, BOOL fSameAsLoad);
// STDMETHODIMP SaveCompleted(IStorage * pStgNew);
// STDMETHODIMP HandsOffStorage(void);
// STDMETHODIMP InitNew(IStorage* pStg);
IMPLEMENT_INTERFACE_UNKNOWN(CDsoFramerControl, PersistStorage)
STDMETHODIMP CDsoFramerControl::XPersistStorage::GetClassID(CLSID *pClassID)
{
ODS("CDsoFramerControl::XPersistStorage::GetClassID\n");
if (pClassID) *pClassID = CLSID_FramerControl;
return S_OK;
}

STDMETHODIMP CDsoFramerControl::XPersistStorage::IsDirty(void)
{
METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
ODS("CDsoFramerControl::XPersistStorage::IsDirty\n");
return (pThis->m_fDirty) ? S_OK : S_FALSE;
}

STDMETHODIMP CDsoFramerControl::XPersistStorage::InitNew(IStorage* pStg)
{
METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
ODS("CDsoFramerControl::XPersistStorage::InitNew\n");
//return pThis->m_xPersistStreamInit.InitNew();
return S_OK;
}

STDMETHODIMP CDsoFramerControl::XPersistStorage::Save(IStorage * pStgSave,
BOOL fSameAsLoad)
{
METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
ODS("CDsoFramerControl::XPersistStorage::Save\n");
if (pStgSave == NULL)
return E_INVALIDARG;

HRESULT hr = E_FAIL;
LPSTREAM pIStream;
static LPCOLESTR vszContents = OLESTR("Contents");
hr = pStgSave->CreateStream(vszContents,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
0, 0, &pIStream);
if (SUCCEEDED(hr))
hr = pThis->m_xPersistStreamInit.Save(pIStream, fSameAsLoad);

pIStream->Release();
return hr;
}

STDMETHODIMP CDsoFramerControl::XPersistStorage::Load(IStorage * pStg)
{
METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
ODS("CDsoFramerControl::XPersistStorage::Load\n");
if (pStg == NULL)
return E_INVALIDARG;

HRESULT hr = E_FAIL;

LPSTREAM pIStream;
hr = pStg->OpenStream(OLESTR("Contents"), NULL,
STGM_DIRECT | STGM_SHARE_EXCLUSIVE, 0, &pIStream);
if (SUCCEEDED(hr))
hr = pThis->m_xPersistStreamInit.Load(pIStream);

pIStream->Release();
return hr;
}

STDMETHODIMP CDsoFramerControl::XPersistStorage::SaveCompleted(IStorage *
pStgNew)
{
METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
ODS("CDsoFramerControl::XPersistStorage::SaveCompleted\n");
return S_OK;
}

STDMETHODIMP CDsoFramerControl::XPersistStorage::HandsOffStorage(void)
{
METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
ODS("CDsoFramerControl::XPersistStorage::HandsOffStorage\n");
return S_OK;
}

//Step 3. modify XInternalUnknown::QueryInterface member function which
exists in dsofcontrol.cpp
// add following code before the line "else if (IID_IPersistPropertyBag ==
riid)"

else if (IID_IPersistStorage == riid)
{
*ppv = (IPersistStorage*)&(pThis->m_xPersistStorage);
}
Re: Bug 72320: SWT Fails to load ActiveX control with error -2147467262 [message #444147 is a reply to message #444054] Thu, 07 October 2004 18:32 Go to previous message
Kenzo is currently offline KenzoFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks for the code! Its really appreciated!


"fan" <fan@ostnet.com> wrote in message news:cjv72o$5ca$1@eclipse.org...
> Hi,
>
> Sorry for late response because I'm working on another project and didn't
> visit swt newsgroup for a while.
>
> I have to say that I'm not a COM expert, so the solution maybe not
perfect,
> it's just for your reference. If you find errors or another good solution,
> please let me know. thanks.
>
> By the way, actually I rewrote the CDsoFramerControl(ActiveX control) by
> using ATL and kept the CDsoDocObject(ActiveX document container), in that
> way, I have integrate our system(COM based) with eclipse, and it works
fine.
>
> //Step 1. Add following code to dsoframer.h
> // IPersistStorage
> BEGIN_INTERFACE_PART(PersistStorage, IPersistStorage)
> STDMETHODIMP GetClassID(CLSID *pClassID);
> STDMETHODIMP IsDirty(void);
> STDMETHODIMP Load(IStorage * pStg);
> STDMETHODIMP Save(IStorage * pStgSave, BOOL fSameAsLoad);
> STDMETHODIMP SaveCompleted(IStorage * pStgNew);
> STDMETHODIMP HandsOffStorage(void);
> STDMETHODIMP InitNew(IStorage* pStg);
> END_INTERFACE_PART(PersistStorage)
>
> //Step 2. add following code to dsofcontrol.cpp
> //////////////////////////////////////////////////////////// ////////////
> // CDsoFramerControl::XPersistStorage -- IPersistStorage Implementation
> // STDMETHODIMP GetClassID(CLSID *pClassID);
> // STDMETHODIMP IsDirty(void);
> // STDMETHODIMP Load(IStorage * pStg);
> // STDMETHODIMP Save(IStorage * pStgSave, BOOL fSameAsLoad);
> // STDMETHODIMP SaveCompleted(IStorage * pStgNew);
> // STDMETHODIMP HandsOffStorage(void);
> // STDMETHODIMP InitNew(IStorage* pStg);
> IMPLEMENT_INTERFACE_UNKNOWN(CDsoFramerControl, PersistStorage)
> STDMETHODIMP CDsoFramerControl::XPersistStorage::GetClassID(CLSID
*pClassID)
> {
> ODS("CDsoFramerControl::XPersistStorage::GetClassID\n");
> if (pClassID) *pClassID = CLSID_FramerControl;
> return S_OK;
> }
>
> STDMETHODIMP CDsoFramerControl::XPersistStorage::IsDirty(void)
> {
> METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
> ODS("CDsoFramerControl::XPersistStorage::IsDirty\n");
> return (pThis->m_fDirty) ? S_OK : S_FALSE;
> }
>
> STDMETHODIMP CDsoFramerControl::XPersistStorage::InitNew(IStorage* pStg)
> {
> METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
> ODS("CDsoFramerControl::XPersistStorage::InitNew\n");
> //return pThis->m_xPersistStreamInit.InitNew();
> return S_OK;
> }
>
> STDMETHODIMP CDsoFramerControl::XPersistStorage::Save(IStorage * pStgSave,
> BOOL fSameAsLoad)
> {
> METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
> ODS("CDsoFramerControl::XPersistStorage::Save\n");
> if (pStgSave == NULL)
> return E_INVALIDARG;
>
> HRESULT hr = E_FAIL;
> LPSTREAM pIStream;
> static LPCOLESTR vszContents = OLESTR("Contents");
> hr = pStgSave->CreateStream(vszContents,
> STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
> 0, 0, &pIStream);
> if (SUCCEEDED(hr))
> hr = pThis->m_xPersistStreamInit.Save(pIStream, fSameAsLoad);
>
> pIStream->Release();
> return hr;
> }
>
> STDMETHODIMP CDsoFramerControl::XPersistStorage::Load(IStorage * pStg)
> {
> METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
> ODS("CDsoFramerControl::XPersistStorage::Load\n");
> if (pStg == NULL)
> return E_INVALIDARG;
>
> HRESULT hr = E_FAIL;
>
> LPSTREAM pIStream;
> hr = pStg->OpenStream(OLESTR("Contents"), NULL,
> STGM_DIRECT | STGM_SHARE_EXCLUSIVE, 0, &pIStream);
> if (SUCCEEDED(hr))
> hr = pThis->m_xPersistStreamInit.Load(pIStream);
>
> pIStream->Release();
> return hr;
> }
>
> STDMETHODIMP CDsoFramerControl::XPersistStorage::SaveCompleted(IStorage *
> pStgNew)
> {
> METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
> ODS("CDsoFramerControl::XPersistStorage::SaveCompleted\n");
> return S_OK;
> }
>
> STDMETHODIMP CDsoFramerControl::XPersistStorage::HandsOffStorage(void)
> {
> METHOD_PROLOGUE(CDsoFramerControl, PersistStorage);
> ODS("CDsoFramerControl::XPersistStorage::HandsOffStorage\n");
> return S_OK;
> }
>
> //Step 3. modify XInternalUnknown::QueryInterface member function which
> exists in dsofcontrol.cpp
> // add following code before the line "else if (IID_IPersistPropertyBag ==
> riid)"
>
> else if (IID_IPersistStorage == riid)
> {
> *ppv = (IPersistStorage*)&(pThis->m_xPersistStorage);
> }
>
>
>
>
Previous Topic:Using CoolbarManager and ToolbarManger on a Shell
Next Topic:can you create a SWT widget off screen and scape graphics?
Goto Forum:
  


Current Time: Thu Oct 22 16:06:23 GMT 2020

Powered by FUDForum. Page generated in 0.06936 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top