Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Trouble instantiating ActiveX control under SWT

Using Word with SWT:

1) Word.Document is an OleDocument and really needs to be created as an 
OleClientSite.  It will bring with it menus and toolbars.  That is just 
the way this guy works.
2) You can create an OleClientSite for each file you want to open using 
the OleClientSite constructor that takes a file name.
3) Use WordBasic to manipulate the file:

// Get generic IDispatch interface
dispInterface = new OleAutomation(clientSite);
 
// Get Application
int[] appId = dispInterface.getIDsOfNames(new String[]{"Application"}); 
if (appId == null) OLE.error(OLE.ERROR_APPLICATION_NOT_FOUND);
Variant pVarResult = dispInterface.getProperty(appId[0]);
if (pVarResult == null) OLE.error(OLE.ERROR_APPLICATION_NOT_FOUND);
application = pVarResult.getAutomation();

// Get Word Basic
int[] wbId = application.getIDsOfNames(new String[]{"WordBasic"});
if (wbId == null) OLE.error(OLE.ERROR_APPLICATION_NOT_FOUND);
Variant pVarResult2 = application.getProperty(wbId[0]);
if (pVarResult2 == null) OLE.error(OLE.ERROR_APPLICATION_NOT_FOUND);
wordBasic = pVarResult2.getAutomation();




"Devon Berry" <dmindsi@xxxxxxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
08/19/2004 06:13 PM
Please respond to
platform-swt-dev


To
platform-swt-dev@xxxxxxxxxxx
cc

Subject
Re: [platform-swt-dev] Trouble instantiating ActiveX control under SWT






Thank you for looking into this with me.  I have entered a bug report: 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=72320

In the mean time, I'm still fighting with other methods of getting Word 
support:

- Directly using Word.Document in an OleControlSite is giving me the 
behavior described in this thread: 
http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg05332.html
- Wrapping Word in Shell.Explorer is failing to inplaceactivate on my 
clients boxes (still trying to figure out why), and enabling/disabling 
items 
on the command bars is not showing up until the next time Word opens 
(whereas it shows up immediately in Excel)
- Using Word.Document as an OleClientSite overrides menus (which I don't 
want) and doesn't show scrollbars (I should be able to address this)

Hopefully, I can find something that will work nicely.

Devon


>From: Veronika Irvine <Veronika_Irvine@xxxxxxxxxx>
>Reply-To: platform-swt-dev@xxxxxxxxxxx
>To: platform-swt-dev@xxxxxxxxxxx
>Subject: Re: [platform-swt-dev] Trouble instantiating ActiveX control 
under 
>SWT
>Date: Thu, 19 Aug 2004 16:46:02 -0400
>
>I tried this myself and was unsuccessful.  I am not sure what is wrong
>here.  SWT uses OleCreate which seems to be failing in this case.  Please
>enter a bug report against Platform SWT.
>
>
>
>
>"Devon Berry" <dmindsi@xxxxxxxxxxx>
>Sent by: platform-swt-dev-admin@xxxxxxxxxxx
>08/19/2004 02:22 PM
>Please respond to
>platform-swt-dev
>
>
>To
>platform-swt-dev@xxxxxxxxxxx
>cc
>
>Subject
>Re: [platform-swt-dev] Trouble instantiating ActiveX control under SWT
>
>
>
>
>
>
>I am using OleControlSite.  I even tried OleClientSite out of desperation
>and neither worked.  The control works just fine under IE and the ActiveX
>Control Test Container.  Any thoughts?  I really would like to get this
>working, as Word has been pretty unruly as an ActiveX control, and my
>client
>is using IE 5.5, which isn't working as a proper inplace container for
>Word.
>
>
>
>Veronika Irvine <Veronika_Irvine@xxxxxxxxxx> wrote:
>
>     You are trying to create an ActiveX control therefore you should use
>     OleControlSite. OleClientSite is only for OLE Documents - an ActiveX
>     control supports different COM interfaces than an Ole Document..
>
>     See:
>
>
>http://www.eclipse.org/articles/Article-ActiveX%20Support%20in%20SWT/ActiveX%20Support%20in%20SWT.html
>
>
>
>
>
>     "Devon Berry"
>     Sent by: platform-swt-dev-admin@xxxxxxxxxxx
>     07/22/2004 01:19 PM
>     Please respond to
>     platform-swt-dev
>
>
>     To
>     platform-swt-dev@xxxxxxxxxxx
>     cc
>
>     Subject
>     [platform-swt-dev] Trouble instantiating ActiveX control under SWT
>
>
>
>
>
>
>     Hello,
>
>     I tried asking this question on the mailing list, but due to its
>     complexity,
>     I think this may be the best place to find an answer...
>
>     I have an open source Office OLE Document container ActiveX control 
I
>     downloaded from Microsoft's website:
>     http://support.microsoft.com/default.aspx?scid=kb;en-us;311765
>
>     I register the control with regsvr32 and it runs nicely under IE and
>VB.
>     However, when I try to instantiate the control under SWT using its
>program
>
>     ID, "DSOFramer.FramerControl", the constructor throws an exception:
>Failed
>
>     to create Ole Client. result = -2147467262 (No Such Interface
>Supported).
>     Stepping through the debugger, I see its the COM.OleCreate native 
call
>     that
>     is failing, returning this result.
>
>     As a side note, I have not built and installed the type library 
(tlb)
>for
>     this control, as I do not have a Visual C++ install handy. The ocx 
is
>     serving as its own type libarary, according to OleViewer.
>
>     I tried downloading the SWT source code to look through the native
>code,
>     but
>     I really am not a COM expert, and on top of that I am crippled 
without
>     VC++
>     . Any ideas?
>
>     Devon
>
>
>_______________________________________________
>platform-swt-dev mailing list
>platform-swt-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>
>
>_______________________________________________
>platform-swt-dev mailing list
>platform-swt-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev




Back to the top