网站首页  词典首页

请输入您要查询的函数:

 

术语 shellexecuteex
释义 ShellExecuteEx
语法:
BOOL ShellExecuteEx( LPSHELLEXECUTEINFO lpExecInfo
);
ShellExecuteEx函数
执行一个指定的文件的操作。
参数
lpExecInfo
[中,输出]指向一个SHELLEXECUTEINFO结构,它包含并接收有关信息的应用程序正在执行。
返回值
如果成功返回TRUE,否则返回false。调用GetLastError函数的错误信息。
备注
由于ShellExecuteEx可以委托执行的Shell扩展(数据源,上下文菜单处理程序,实现动词)是被激活使用组件对象模型(COM)时,COM应被初始化之前ShellExecuteEx调用。有些Shell扩展需要的COM单线程单元(STA)的类型。在这种情况下,初始化的COM应该如下所示:
CoInitializeEx的(空,COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)在有些情况下不使用ShellExecuteEx的外壳扩展这些类型之一,这种情况下,不需要的COM进行初始化的。然而,这是很好的做法始终initalize使用此功能前的COM。
与多台监视器,如果您指定一个hWnd并设置lpExecInfo lpVerb成员“属性”,由ShellExecuteEx创造可能不会出现在正确的位置任何窗口。
如果函数成功,它设置了SHELLEXECUTEINFO结构hInstApp成员的值比32大。如果函数失败,hInstApp设置为SE_ERR_XXX错误值最指示失败的原因。虽然hInstApp是作为与16位Microsoft Windows应用程序的兼容性HINSTANCE宣布,它不是一个真正的hInstance。它只能被强制转换为int和比较都有32或SE_ERR_XXX错误代码。
在SE_ERR_XXX错误值使用ShellExecute提供兼容性。为了获得更准确的错误信息,使用GetLastError。它可能会返回下列值之一:
ErrorDescription
ERROR_FILE_NOT_FOUND指定的文件未找到。
ERROR_PATH_NOT_FOUND指定的路径未找到。
ERROR_DDE_FAIL的动态数据交换(DDE)交易失败。
ERROR_NO_ASSOCIATION有给定的文件扩展名相关联的应用程序。
ERROR_ACCESS_DENIED访问到指定的文件被拒绝。
ERROR_DLL_NOT_FOUND库的一个必需的文件,运行该应用程序无法找到。
ERROR_CANCELLED函数促使更多的信息,用户,但用户取消了请求。
ERROR_NOT_ENOUGH_MEMORY没有足够的内存来执行指定的操作。
ERROR_SHARING_VIOLATION共享冲突发生。
在Windows 95/98/Me:ShellExecuteEx是支持的Unicode(MSLU)微软层。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98系统。
功能信息
最低DLL版本 shell32.dll版本3.51或更高版本
自定义ImplementationNo
Headershellapi.h
import libraryshell32.lib
最低经营systemsWindows NT 4.0中,Windows 95中
UnicodeImplemented为ANSI和Unicode版本。
参见
ShellExecute,IShellExecuteHook,CoInitializeEx的
==英文原文==ShellExecuteEx Function
Performs an operation on a specified file.
Syntax
BOOL ShellExecuteEx( LPSHELLEXECUTEINFO lpExecInfo
);
Parameters
lpExecInfo
[in, out] A pointer to a SHELLEXECUTEINFO structure that contains and receives information about the application being executed.
Return Value
Returns TRUE if successful, or FALSE otherwise. Call GetLastError for error information.
Remarks
Because ShellExecuteEx can delegate execution to Shell extensions (data sources, context menu handlers, verb implementations) that are activated using Component Object Model (COM), COM should be initialized before ShellExecuteEx is called. Some Shell extensions require the COM single-threaded apartment (STA) type. In that case, COM should be initialized as shown here:
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)There are instances where ShellExecuteEx does not use one of these types of Shell extension and those instances would not require COM to be initialized at all. Nonetheless, it is good practice to always initalize COM before using this function.
With multiple monitors, if you specify an HWND and set the lpVerb member of lpExecInfo to "Properties", any windows created by ShellExecuteEx may not appear in the correct position.
If the function succeeds, it sets the hInstApp member of the SHELLEXECUTEINFO structure to a value greater than 32. If the function fails, hInstApp is set to the SE_ERR_XXX error value that best indicates the cause of the failure. Although hInstApp is declared as an HINSTANCE for compatibility with 16-bit Microsoft Windows applications, it is not a true HINSTANCE. It can only be cast to an int and compared to either 32 or the SE_ERR_XXX error codes.
The SE_ERR_XXX error values are provided for compatibility with ShellExecute. To retrieve more accurate error information, use GetLastError. It may return one of the following values:
ErrorDescription
ERROR_FILE_NOT_FOUND The specified file was not found.
ERROR_PATH_NOT_FOUND The specified path was not found.
ERROR_DDE_FAIL The Dynamic Data Exchange (DDE) transaction failed.
ERROR_NO_ASSOCIATION There is no application associated with the given file name extension.
ERROR_ACCESS_DENIED Access to the specified file is denied.
ERROR_DLL_NOT_FOUND One of the library files necessary to run the application can't be found.
ERROR_CANCELLED The function prompted the user for additional information, but the user canceled the request.
ERROR_NOT_ENOUGH_MEMORY There is not enough memory to perform the specified action.
ERROR_SHARING_VIOLATION A sharing violation occurred.
Windows 95/98/Me: ShellExecuteEx is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows Me/98/95 Systems .
Function Information
Minimum DLL Versionshell32.dll version 3.51 or later
Custom ImplementationNo
Headershellapi.h
Import libraryshell32.lib
Minimum operating systemsWindows NT 4.0, Windows 95
UnicodeImplemented as ANSI and Unicode versions.
See Also
ShellExecute , IShellExecuteHook , CoInitializeEx
==原始网址==http://msdn.microsoft.com/en-us/library/bb762154(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:22:27