事件处理打开(Win​​Api) [英] Event to handle Open With (WinApi)

查看:110
本文介绍了事件处理打开(Win​​Api)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到我应该如何处理我的程序中的文件打开。例如,如果用户打开... myprogram.exe那么我该如何处理,并做一些事情。哪个WM_Message发送?
感谢

I cannot find how I'm supposed to handle file opening in my program. For example if the user does Open With ... myprogram.exe then how do I handle that and do something with it. which WM_Message is sent? Thanks

*不是我的意思是如果你有sometext.txt和openwith Notepad.exe,它神奇地显示文本,所以我怎么知道是否有人使用打开方式。

*no I mean if you have sometext.txt and openwith Notepad.exe, it magically displays the text, so how can I know if someone used Open With.

推荐答案

没有消息发送,您可能会在命令行上使用argc / argv或GetCommandLine )

There is no message sent, you will probably get it on the commandline, use argc/argv or GetCommandLine()

shell首先检查 NoOpenWith 值,如果它不存在,您的应用程序被列在打开与对话框中的KCR \Applications\myprogram.exe。
如果用户选择您的应用程序,shell将使用 HKCR\Applications\myprogram.exe \shell\open\Command(如果存在)下面列出的命令(然后可以分配DDE或Droptarget属性,如果您希望处理它们进来的文件)

The shell first checks for a NoOpenWith value in KCR\Applications\myprogram.exe if it is not there, your app is listed in the open with dialog. If the user chooses your app, the shell will use the command listed under HKCR\Applications\myprogram.exe\shell\open\Command if it exists (You could then assign DDE or Droptarget properties if that is how you want to handle the "incoming files")

如果你真的想知道是否使用openwith,我想你可以注册一个命令在shell键下执行你的应用程序使用命令像myprogram.exe / openwith%1一样。

If you really want to know if openwith was used, I guess you could register a command under the shell key that executes your app with a command line like myprogram.exe /openwith "%1"

这篇关于事件处理打开(Win​​Api)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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