是否可以通过拖放和通过附件菜单按钮来区分添加的附件 [英] Is it possible to distinguish between attachments added with drag and drop and via the attachment menu button

查看:79
本文介绍了是否可以通过拖放和通过附件菜单按钮来区分添加的附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Outlook加载项,可以处理电子邮件附件.我有自己的功能区按钮来添加附件,但是我想捕捉通过拖放添加的附件,而忽略使用标准附件按钮添加的附件.

I have an outlook add-in that handles email attachments. I have my own ribbon button to add attachments but I would like to catch attachments added via drag and drop while ignoring attachments added using the standard attachment button.

实现ItemEvents_10_BeforeAttachmentAddEventHandler()很容易,但是我无法区分通过拖放和通过附件菜单按钮添加的附件.

It is easy enough to implement a ItemEvents_10_BeforeAttachmentAddEventHandler() but I know of no way to distinguish between attachments added with drag and drop and via the attachment menu button.

这可能吗?

是否可以直接处理自己的拖放事件?

Is it possible to handle the drag and drop event directly my self?

推荐答案

OOM在这里无法为您提供帮助. 从理论上讲,您可以覆盖Outlook拖放处理程序.

OOM won't help you here. In theory, you can overwrite the Outlook drag/drop handler.

  1. 使用IOleWindow界面获取检查器的窗口句柄(可以将Inspector对象投射到IOleWindow).
  2. 使用GetProp(hwnd, "OleDropTargetInterface") Windows API获取现有的拖放处理程序-将返回的值强制转换为IDropTarget界面.您可能需要试验检查器的哪个子窗口是您想要的拖放目标.
  3. 调用RevokeDragDrop/RegisterDragDrop传递您自己的IDropTarget实现.然后,该实现可以(在完成您需要的操作之后)调用原始的IDropTarget接口,以使Outlook继续执行默认行为.
  1. Get the Inspector's window handle using the IOleWindow interface (you can cast Inspector object to IOleWindow).
  2. Get the existing drag/drop handler using GetProp(hwnd, "OleDropTargetInterface") Windows API - cast the returned value to IDropTarget interface. You probably need to experiment with which child window of the inspector is the drag/drop target you want.
  3. Call RevokeDragDrop / RegisterDragDrop passing your own implementation of IDropTarget. That implementation can then (after doing what you need to do) call the original IDropTarget interface to let Outlook proceed with the default behavior.

这篇关于是否可以通过拖放和通过附件菜单按钮来区分添加的附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆