gpt4 book ai didi

winapi - 哪些原因会导致 ShellExecute 失败?

转载 作者:行者123 更新时间:2023-12-03 22:59:02 26 4
gpt4 key购买 nike

我有一个 VB6 应用程序,它使用以下方法打开文件及其关联的应用程序:

ShellExecute(0, "open", filename, params, vbNullString, vbNormalFocus)

这完美地工作。

现在我有一个客户(使用 Adob​​e Reader 运行 XP)无法使用上述命令打开任何 PDF 文件。但是当从 Windows 资源管理器中双击它时,可以毫无问题地打开同一个文件。我还在我的机器上测试了文件名/路径组合以排除这些问题。

我正在寻找有关我可以检查的任何提示以确保 ShellExecute正在工作。或者什么会导致 ShellExecute 以这种方式失败?

最佳答案

进一步到托马斯的 answer ,这里有一些 VB6 常量,用于 ShellExecute 的可能返回值,以及可能的解释(我想我最初是从 MSDN page 的返回值部分中获取的)。返回值等于或小于 32 表示调用失败。返回的特定值指示出了什么问题。

Const ERROR_BAD_FORMAT = 11&
Const ERROR_FILE_NOT_FOUND = 2&
Const ERROR_PATH_NOT_FOUND = 3& ' The specified path was not found. '
Const SE_ERR_ACCESSDENIED = 5 ' The operating system denied access to the specified file. '
Const SE_ERR_ASSOCINCOMPLETE = 27 ' The file name association is incomplete or invalid. '
Const SE_ERR_DDEBUSY = 30 ' The Dynamic Data Exchange (DDE) transaction could not be completed because other DDE transactions were being processed. '
Const SE_ERR_DDEFAIL = 29 ' The DDE transaction failed. '
Const SE_ERR_DDETIMEOUT = 28 ' The DDE transaction could not be completed because the request timed out. '
Const SE_ERR_DLLNOTFOUND = 32 ' The specified dynamic-link library (DLL) was not found. '
Const SE_ERR_FNF = 2 ' The specified file was not found. '
Const SE_ERR_NOASSOC = 31 ' There is no application associated with the given file name extension. '
Const SE_ERR_OOM = 8 ' out of memory '
Const SE_ERR_PNF = 3 ' path not found '
Const SE_ERR_SHARE = 26 ' A sharing violation occurred. '

关于winapi - 哪些原因会导致 ShellExecute 失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1193873/

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