Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Confused about SWT OLE on 64-bit Windows(I observe different results when using the different OleClientSite constructors on windows 64-bit, could this difference in loading the OLE object be a bug?)
Confused about SWT OLE on 64-bit Windows [message #1019246] Fri, 15 March 2013 10:11 Go to next message
Michael Whapples is currently offline Michael WhapplesFriend
Messages: 6
Registered: July 2009
Junior Member
I am running Windows 7 64-bit with MS word 2003 32-bit. If I use a 32-bit JVM and the 32-bit SWT I can get SWT snippet 262 to work fine and I get word embedded in a window. However, should I use a 64-bit JVM and the 64-bit SWT then the constructor of OleClientSite fails to load and gives error code -2147221164 (or in hex 0x80040154).

Snippet 262 is using the constructor by specifying the program ID as "Word.Document". Should I change it so that it uses the constructor where a file is specified (eg. new File("d:\\test.doc") ) then Word does embed in the 64-bit JVM and 64-bit SWT.

Also if I make the call OLE.findProgramID("doc") it returns "Word.Document.8" but even if I pass this version specific program ID into the constructor of OleClientSite it still fails to embed word giving the error code -2147221164.

Why do I get these different results when calling the constructor of OleClientSite with program ID or a file? Is this a bug? In my mind it is not what I would have expected, word obviously can be embedded and can be found by the 64-bit JVM and SWT, so I would have thought so it could do this when giving the program ID.
Re: Confused about SWT OLE on 64-bit Windows [message #1027237 is a reply to message #1019246] Tue, 26 March 2013 18:37 Go to previous message
Binko Binev is currently offline Binko BinevFriend
Messages: 20
Registered: June 2012
Junior Member
As I wrote in your other therad it may be with the registry keys.

Your exception means


REGDB_E_CLASSNOTREG
0x80040154

Class not registered

http://msdn.microsoft.com/en-us/library/windows/desktop/dd542643%28v=vs.85%29.aspx

So it just cannot find the proper class. Check your registry for the .doc extension and for Word.Document.8. They are for Word 2003

I am working with .docx and Word.Document.12. They are for Word 2007 upwards. They are Open XML based. I have not tested the compatibility of the OLE automations.

I have another problem. I have already described it in my previos answer , so sorry for disturbing again.

I get sometimes a crash of the whole Word application in the following ocde:


/**
	 * Returns the row in the table with the given index
	 * @param tableVar - table variant
	 * @param rowIndex - row index
	 * @return rowVariant - row Variant
	 * @throws OleException
	 */
	public static Variant getRow(Variant tableVar, int rowIndex) throws OleException {
		OleAutomation tableAuto = tableAuto = tableVar.getAutomation();
		OleUtils.printAutomation(tableAuto);
		Variant rowsVar = null;
		while (rowsVar == null){
			rowsVar = tableAuto.getProperty(101/*Rows*/);
		}
		OleAutomation rowsAuto = rowsVar.getAutomation();
		Variant rowVar = rowsAuto.invoke(0/*Item*/, new Variant[]{new Variant(rowIndex)});
		return rowVar;
	}



Sometimes it works , but now always. I am using it for a complex table with a number of rows. For the first table works OK.
For the second table it works sometimes - for eover 70 rows.
Sometimes crashes and I cannot find the reason.
Any ideas may be?

Sorry for disturbing but there are not so many people working extensively with OLE SWT Word automations, so we may be mutually useful in dealing with this topic.



Previous Topic:Embed word starting with a specified file
Next Topic:OleFrame&OleClientSite for Excel
Goto Forum:
  


Current Time: Fri Dec 19 16:04:24 GMT 2014

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

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