gpt4 book ai didi

c++ - 处理打开方式的事件 (WinApi)

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:13:39 25 4
gpt4 key购买 nike

我找不到我应该如何在我的程序中处理文件打开。例如,如果用户使用 Open With ... myprogram.exe 那么我该如何处理它并对其进行处理。发送哪个 WM_Message?谢谢

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

最佳答案

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

shell 首先检查 NoOpenWith KCR\Applications\myprogram.exe 中的值如果不存在,您的应用程序将列在打开方式对话框中。如果用户选择您的应用程序,shell 将 use the command listed under HKCR\Applications\myprogram.exe\shell\open\Command 如果它存在(如果这是你想要处理“传入文件”的方式,那么你可以分配 DDE 或 Droptarget 属性)

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

关于c++ - 处理打开方式的事件 (WinApi),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2706538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com