com4j

Why am I not receiving COM events via Com4J?

I am using Com4J to interact with Microsoft Outlook. I have generated the Java type definitions as per the Com4J tutorial. Here is an example of some code that waits for the user to close an email. // Registers my event handler mailItem.advise( ItemEvents.class, new ItemEvents() { @Override public...

How can I find the typelib identifier of the DirectShow interfaces for use with COM4j

I'm trying to interact with a webcam from Java on Windows (without going through the FMJ or JMF frameworks) by using COM4j. However, I'm unable to find the typelib identifier for Direct Show in order to build the interfaces. The COM4j site recommends using OleView to find the typelib, but I've gone through the list of typelibs there an...

Why am I receiving "80020005 Type mismatch" exception with com4j?

I am trying to attach an image to an email via Microsoft Outlook's COM interface and the com4j library: _Application application = ClassFactory.createApplication(); _MailItem mailItem = application.createItem(OlItemType.olMailItem).queryInterface(_MailItem.class); Attachments attachments = mailItem.attachments(); attachments.add("C:\\...

How to save excel workbook using com4j API without being prompted

I'm trying to save a workbook that has been modified automatically. Here is an example: import excel.*; import com4j.Variant; import static com4j.Variant.MISSING; public class ExcelDemo { public static void main(String[] args) { _Application app = excel.ClassFactory.createApplication(); app.visible(0,false); //Varian...

Using COM objects with WIA and com4j in Java

Hi all I am a newbie in this and I wanted to ask if you could recommend me some articles, examples etc to start with communicating with scanner in java application I am developing a module that should communicate with different scanners conected directly or in the local network... I would like WIA to start with and com4j.. thanks all for...

Print MSWord-Document with com4j

I'm trying to print out a .doc-File with com4j. This is my Code: document.printOut2000(true, false, WdPrintOutRange.wdPrintAllDocument, newDocumentPath, _, _, WdPrintOutItem.wdPrintDocumentContent, 1, _, WdPrintOutPages.wdPrintAllPages, true, true, _, false, 0, 0, 0, 0); I got the values from a recorded Word-Macro and http://msdn.mic...