- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在编写一个使用 Jacob library 与 Microsoft Outlook 交互的 Java 程序。 (桥接 COM 和 Java)。该程序创建了一个新的 MailItem , displaying它的 Inspector用户的窗口。我想订阅督察的Close event知道用户何时完成编辑他们的邮件项目。
要订阅该 Activity ,我按照 Jacob's documentation 中的说明进行操作。 (页面下方约 2⁄3):
The current [event] model is conceptually similar to the Visual Basic
WithEvents
construct. Basically, I provide a class calledcom.jacob.com.DispatchEvents
which has a constructor that takes a source object (of typecom.jacob.com.Dispatch
) and a target object (of any type). The source object is queried for itsIConnectionPointContainer
interface and I attempt to obtain anIConnectionPoint
for its default source interface (which I obtain fromIProvideClassInfo
). At the same time, I also create a mapping of DISPID's for the default source interface to the actual method names. I then use the method names to getjmethodID
handles from the target Java object. All event methods currently must have the same signature: one argument which is a Java array of Variants, and a void return type.
InspectorEventHandler
类,符合雅各布的文档:
public class InspectorEventHandler {
public void Activate(Variant[] arguments) {
}
public void BeforeMaximize(Variant[] arguments) {
}
public void BeforeMinimize(Variant[] arguments) {
}
public void BeforeMove(Variant[] arguments) {
}
public void BeforeSize(Variant[] arguments) {
}
public void Close(Variant[] arguments) {
System.out.println("Closing");
}
public void Deactivate(Variant[] arguments) {
}
public void PageChange(Variant[] arguments) {
}
}
InspectorEventHandler
类(class):
Object outlook = new ActiveXComponent("Outlook.Application");
Object mailItem = Dispatch.call(outlook, "CreateItem", 0).getDispatch();
Object inspector = Dispatch.get(mailItem, "GetInspector").getDispatch();
InspectorEventHandler eventHandler = new InspectorEventHandler();
// This supposedly registers eventHandler with the inspector
new DispatchEvents((Dispatch) inspector, eventHandler);
Exception in thread "main" com.jacob.com.ComFailException: Can't find event iid at com.jacob.com.DispatchEvents.init(Native Method) at com.jacob.com.DispatchEvents.(DispatchEvents.java) at cake.CakeApplication.run(CakeApplication.java:30) at cake.CakeApplication.main(CakeApplication.java:15)couldn't get IProvideClassInfo
According to Google, a few others have also received this error. Unfortunately, none of them have received an answer.
I am using version 1.7 of the Jacob library, which claims to prevent this problem:
Version 1.7 also includes code to read the type library directly from the progid. This makes it possible to work with all the Microsoft Office application events, as well as IE5 events. For an example see the samples/test/IETest.java example.
I noticed that the aforementioned IETest.java
file subscribes to events like this:
new DispatchEvents((Dispatch) ieo, ieE,"InternetExplorer.Application.1");
new DispatchEvents((Dispatch) inspector, eventHandler, "Outlook.Application");
new DispatchEvents((Dispatch) inspector, eventHandler, "Outlook.Application.1");
new DispatchEvents((Dispatch) inspector, eventHandler, "Outlook.Application.12");
最佳答案
经过一些实验,我确定订阅 MailItem
's Close
event 可以达到预期的效果。而不是 Inspector
's Close
event .我现在有一个 MailItemEventHandler
处理所有的类 MailItem
events :
public class MailItemEventHandler {
public void AttachmentAdd(Variant[] arguments) {
System.out.println("AttachmentAdd");
}
public void AttachmentRead(Variant[] arguments) {
System.out.println("AttachmentRead");
}
public void AttachmentRemove(Variant[] arguments) {
System.out.println("AttachmentRemove");
}
public void BeforeAttachmentAdd(Variant[] arguments) {
System.out.println("BeforeAttachmentAdd");
}
public void BeforeAttachmentPreview(Variant[] arguments) {
System.out.println("BeforeAttachmentPreview");
}
public void BeforeAttachmentRead(Variant[] arguments) {
System.out.println("BeforeAttachmentRead");
}
public void BeforeAttachmentSave(Variant[] arguments) {
System.out.println("BeforeAttachmentSave");
}
public void BeforeAttachmentWriteToTempFile(Variant[] arguments) {
System.out.println("BeforeAttachmentWriteToTempFile");
}
public void BeforeAutoSave(Variant[] arguments) {
System.out.println("BeforeAutoSave");
}
public void BeforeCheckNames(Variant[] arguments) {
System.out.println("BeforeCheckNames");
}
public void BeforeDelete(Variant[] arguments) {
System.out.println("BeforeDelete");
}
public void Close(Variant[] arguments) {
System.out.println("Close");
}
public void CustomAction(Variant[] arguments) {
System.out.println("CustomAction");
}
public void CustomPropertyChange(Variant[] arguments) {
System.out.println("CustomPropertyChange");
}
public void Forward(Variant[] arguments) {
System.out.println("Forward");
}
public void Open(Variant[] arguments) {
System.out.println("Open");
}
public void PropertyChange(Variant[] arguments) {
System.out.println("PropertyChange");
}
public void Read(Variant[] arguments) {
System.out.println("Read");
}
public void Reply(Variant[] arguments) {
System.out.println("Reply");
}
public void ReplyAll(Variant[] arguments) {
System.out.println("ReplyAll");
}
public void Send(Variant[] arguments) {
System.out.println("Send");
}
public void Unload(Variant[] arguments) {
System.out.println("Unload");
}
public void Write(Variant[] arguments) {
System.out.println("Write");
}
}
Object outlook = new ActiveXComponent("Outlook.Application");
Object mailItem = Dispatch.call(outlook, "CreateItem", 0).getDispatch();
MailItemEventHandler eventHandler = new MailItemEventHandler();
new DispatchEvents((Dispatch) mailItem, eventHandler);
Inspector
有问题对象注册...
关于Java、Jacob 和 Microsoft Outlook 事件 : Receiving "Can' t find event iid"Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3052963/
我的代码曾经可以工作。它做到了: import iid from '@react-native-firebase/iid'; ... tokenDevice = await iid().getTo
我的手机设备出现此错误。我已经启用了钥匙串(keychain)功能,但它不起作用。 在第一次启动应用程序时,fcm sdk 返回 token ,但在断开连接并重新连接后,Api 在 token 中返回
当我使用来自 microsoft docs to migrate to winrt from cx 的辅助函数时,这个错误发生在我身上.我看到一个类似的问题 here ,但提到的解决方案似乎对我不起作
我正在编写与 Firefox 3.0 到 3.6 版本兼容的 Firefox 扩展。 我正在使用 nsIDOMNSHTMLElement 接口(interface)指针来设置 html 元素的内部文本
我有一个树状 View ,并已将一些数据插入其中,如下所示。 self.tree.insert('', 'end', iid="test1", text="test a", values=("data
我有一个树状 View ,并已将一些数据插入其中,如下所示。 self.tree.insert('', 'end', iid="test1", text="test a", values=("data
这个问题在这里已经有了答案: Failed to resolve: com.google.firebase:firebase-core:16.0.1 (14 个回答) 关闭3年前。 This is S
我正在使用 tkinter,特别是 ttk.treeview 小部件来显示元组。我做了很多插入操作,想知道 iid(项目标识符)是否会溢出或如何处理。我假设最大 iid 为 0xFFF,相当于 409
查看由 CCW 创建的生成的 TLB 文件,尽管 OLE/COM 对象查看器显示 IID 保持不变,除非我更改接口(interface)的设计(这是正确的行为),我担心的是,如果我在尽管接口(inte
我想通过 firebase 发送通知。当我发送通知时,我的应用程序崩溃,在 logcat 中显示这种类型的堆栈跟踪: java.lang.RuntimeException: Unable to in
我正在尝试在 R 中运行 rjags(通过 Rstudio)来估计以下模型的参数 alpha&beta 和超参数 tau.nu: y_i|x_i~pois(eta_i), eta_i=exp(alph
我的应用程序集成了 FCM 以接收推送通知并且运行正常。但是,我面临的问题是安装时它会随机崩溃。它是非常随机的,并且发生在 OS 6.0+ 设备上,直到最新但随机发生。 代码方面,在服务类中只显示通知
精简版 如何在使用 IMetadataImport 时从 *.winmd 文件获取接口(interface)的接口(interface)标识符 (IID)? 例如Windows.Globalizati
请帮助解决此错误 apply plugin: 'com.android.application' android { 编译版本28 defaultConfig { applicationId“com.
在尝试托管 CLR 时,我不断收到以下消息: error C2440: 'function' : cannot convert from 'const IID' to 'DWORD' 我的代码: IC
Here是一些使用 windows.gaming.input.h API 的原始 C 代码: HSTRING gamepadClassName; if (FAILED(WindowsC
在尝试托管 CLR 时,我不断收到以下信息: error C2440: 'function' : cannot convert from 'const IID' to 'DWORD' 我的代码: IC
如何在不知道它实现的任何接口(interface)的情况下通过类的 CLSID 创建类的实例。 例如,CLSID "{3ad05575-8857-4850-9277-11b85bdb8e09}" 实现
我制作了一个 Android 插件以在我的 Unity 应用程序中使用 GCM。当我尝试启动 RegistrationIntentService(来自 Android 开发人员手册网站的现成示例类)时
我正在编写一个应将推送通知从服务器发送到 Android 和 iOS 设备的应用程序。为此,我尝试使用 FCM。iOS 应用程序使用 APNS,因此我可以在服务器端获取 apns 订阅 token 。
我是一名优秀的程序员,十分优秀!