Home > database >  FindExecutable is not successful, the return value=2
FindExecutable is not successful, the return value=2

Time:09-17

FindExecutable not successful return value=2

Specific what reason be?

Code:

The Function uint GetModuleHandle (string ModuleName) Library "Kernel. Exe
"The Function uint GetModuleUsage (uint ModuleHandle) Library "Kernel. Exe
"The FUNCTION ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA
"
//of_check_isruning
//return: Boolean
//whether exe in carrying out
The integer li_size=144, li_result
String ls_executable=Space (li_size)
The integer li_module_usage
Uint li_module_handle
Li_result=FindExecutable (as_exename as_exedir, ls_executable)//the return value=2
IF li_result & lt; 32 THEN Return FALSE
//such as executable file has been loaded, access to the file handle
Li_module_handle=GetModuleHandle (ls_executable)
IF li_module_handle & lt; 1 THEN
//not loaded
Return FALSE
The ELSE
//to get how many instances in the
Li_module_usage=GetModuleUsage (li_module_handle)
Return TRUE
END the IF

CodePudding user response:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb776419%28v=vs.85%29.aspx

The specified file was not found.

Check your as_exename parameter values, did take a look at the path or executable file

CodePudding user response:

reference 1st floor SDHP response:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb776419%28v=vs.85%29.aspx
The specified file was not found.

Check your as_exename parameter values, did take a look at the path or executable file


The file is
Such as:
As_exename='rwfile. Exe'
As_exedir='E: \ \ EA RWFile \'
Or
As_exedir='E: \ \ EA RWFile
'
Return 2




CodePudding user response:

Change the statement to

The FUNCTION ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA; Ansi
"
Have a try

CodePudding user response:

See answer upstairs, suddenly think: what is your PB version?
9 the following use ALIAS FOR "FindExecutableA; Ansi is right
"If it is more than 10 or 10 should use ALIAS FOR "FindExecutableW"

CodePudding user response:

The
reference 3 floor lzp_lrp response:
change the statement to

The FUNCTION ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA; Ansi
"
Try


FindExecutable return value correctly,

GetModuleHandle returns a value correct program has run, but the return value is 0, is there a way to solve?

//declare
The Function uint GetModuleHandle (string ModuleName) Library "KERNEL32. DLL" ALIAS FOR "GetModuleHandleA; Ansi
"The Function uint GetModuleUsage (uint ModuleHandle) Library "KERNEL32. DLL" ALIAS FOR "GetModuleUsage; Ansi
"The Function ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA; Ansi
"

CodePudding user response:

reference 5 floor Cideason reply:
Quote: refer to the third floor lzp_lrp response:

Change the statement to

The FUNCTION ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA; Ansi
"
Try


FindExecutable return value correctly,

GetModuleHandle returns a value correct program has run, but the return value is 0, is there a way to solve?

//declare
The Function uint GetModuleHandle (string ModuleName) Library "KERNEL32. DLL" ALIAS FOR "GetModuleHandleA; Ansi
"The Function uint GetModuleUsage (uint ModuleHandle) Library "KERNEL32. DLL" ALIAS FOR "GetModuleUsage; Ansi
"The Function ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA; Ansi
"


FindExecutable return value correctly,

GetModuleHandle returns a value right

The return value is wrong?

CodePudding user response:

refer to 6th floor lzp_lrp response:
Quote: refer to the fifth floor Cideason reply:

Quote: refer to the third floor lzp_lrp response:

Change the statement to

The FUNCTION ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA; Ansi
"
Try


FindExecutable return value correctly,

GetModuleHandle returns a value correct program has run, but the return value is 0, is there a way to solve?

//declare
The Function uint GetModuleHandle (string ModuleName) Library "KERNEL32. DLL" ALIAS FOR "GetModuleHandleA; Ansi
"The Function uint GetModuleUsage (uint ModuleHandle) Library "KERNEL32. DLL" ALIAS FOR "GetModuleUsage; Ansi
"The Function ulong FindExecutable (ref string lpFile, ref string lpDirectory, ref string lpResult) LIBRARY "shell32. DLL" ALIAS FOR "FindExecutableA; Ansi
"


FindExecutable return value correctly,

GetModuleHandle returns a value right

The return value is wrong?


Should be:
null
  • Related