Retrieves the name of and handle to the executable (.exe) file associated with a specific document file.
HINSTANCE FindExecutableA( LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult );
The address of a null-terminated string that specifies a file name. This file should be a document.
The address of a null-terminated string that specifies the default directory. This value can be NULL.
The address of a buffer that receives the file name of the associated executable file. This file name is a null-terminated string that specifies the executable file started when an "open" by association is run on the file specified in the lpFile parameter. Put simply, this is the application that is launched when the document file is directly double-clicked or when Open is chosen from the file's shortcut menu. This parameter must contain a valid non-null value and is assumed to be of length MAX_PATH. Responsibility for validating the value is left to the programmer.
Returns a value greater than 32 if successful, or a value less than or equal to 32 representing an error.
The following table lists possible error values.
||The specified file was not found.|
||The specified path is invalid.|
||The specified file cannot be accessed.|
||The system is out of memory or resources.|
||There is no association for the specified file type with an executable file.|
Use FindExecutable for documents. If you want to retrieve the path of an executable file, use the following:
AssocQueryString(ASSOCF_OPEN_BYEXENAME, ASSOCSTR_EXECUTABLE, pszExecutableName, NULL, pszPath, pcchOut);
When FindExecutable returns, the lpResult parameter may contain the path to the Dynamic Data Exchange (DDE) server started if a server does not respond to a request to initiate a DDE conversation with the DDE client application.
|Windows version||Windows XP [desktop apps only] Windows 2000 Server [desktop apps only]|