OLE Outlook [message #449590] |
Wed, 26 January 2005 14:45  |
Eclipse User |
|
|
|
I am trying to talk to Microsoft Outlook from SWT. (What I really need to do
is access the AddressBook.) I was able to embed a Word document into my
application, but when I use the same technique for Outlook - it fails.
The code below:
OleFrame frame = new OleFrame (shell, SWT.NONE);
OleControlSite site = new OleControlSite (frame, SWT.NONE,
"Outlook.Application");
site.doVerb (OLE.OLEIVERB_UIACTIVATE);
OleAutomation outlook = new OleAutomation(site);
only works when Outlook is already open. If Outlook is not open - I get the
following EXCEPTION:
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.swt.ole.win32.OleAutomation.<init>(OleAutomation.java:114)
at Outlook.main(Outlook.java:29)
Any ideas on how to avoid this? (It's a weird requirement to have the
customer open Outlook before running the program.)
Thanx,
- Kalman
|
|
|
|
Re: OLE Outlook [message #1027275 is a reply to message #449590] |
Tue, 26 March 2013 15:54  |
Eclipse User |
|
|
|
Hi,
Sorry for disturbing you but may be you have ideas how my problem can be solved.
I saw that you have worked with OLE and may be you know the solution of my problem.
the problem is the following. I have an embedded Word document and I process the rows of a table in the document.
Sometimes it works, but sometimes the whole word application crashes.
This is the method where i get the row
/**
* 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 the method crashes and returns rowsvar as null.
How can I sove this problem? Any ideas?
|
|
|
Powered by
FUDForum. Page generated in 0.03912 seconds