How to find if an document can be OPENed via ShellExecute?

∥☆過路亽.° 提交于 2019-12-04 11:18:19

I always use FindExecutable() to get the registered application for a given document.

There is another way to do this, using the ASSOCF_INIT_IGNOREUNKNOWN option flag with AssocQueryString().

int err = AssocQueryString(ASSOCF_INIT_IGNOREUNKNOWN, ASSOCSTR_EXECUTABLE, ".mxf", NULL ,buff , &size);

This has a couple of important advantages over using FindExecutable()

  • It can work with just the file extension, while FindExecutable needs a full path to an existing file of the specified type.
  • Because it's not accessing the file, it's much faster with Samba and other network storage. Calling FindExecutable() on one file in a directory containing ~3000 files via Samba took > 1 second in my tests.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!