FindExecutableFindExecutable*
*Contents  *Index  *Topic Contents
*Previous Topic: DragQueryPoint
*Next Topic: GetMenuContextHelpId

FindExecutable

Retrieves the name of and handle to the executable (.exe) file associated with the specified file name.

Syntax


HINSTANCE FindExecutable(
    LPCTSTR lpFile,
    LPCTSTR lpDirectory,
    LPTSTR lpResult
);

Parameters

lpFile
Address of a null-terminated string specifying a file name. This can be a document or executable file.
lpDirectory
Address of a null-terminated string specifying the default directory.
lpResult
Address of a buffer to receive the file name when the function returns. This file name is a null-terminated string specifying the executable file started when an "open" by association is run on the file specified in the lpFile parameter.

Return Values


Returns a value greater than 32 if successful, or a value less than or equal to 32 otherwise.

The following table lists the possible error values:
0The system is out of memory or resources.
31There is no association for the specified file type.
ERROR_FILE_NOT_FOUND The specified file was not found.
ERROR_PATH_NOT_FOUNDThe specified path was not found.
ERROR_BAD_FORMATThe .exe file is invalid (non-Win32 .exe or error in .exe image).

Remarks


When FindExecutable returns, the lpResult parameter may contain the path to the DDE (Dynamic Data Exchange) server started if a server does not respond to a request to initiate a DDE conversation with the DDE client application.

See Also


ShellExecute


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.