Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (Byval hModule As Long, Byval lpFileName As String, Byval nSize As Long) As Long
Function GetModuleName (moduleName As String) As Boolean
%REM
<information>
<description>
Function retrieves the full path and filename for the executable file containing the specified module
</description>
<input params>
moduleName - string
</input params>
<output params>
moduleName - full path and filename for the executable file containing the specified module
</output params>
<result>
true - функция выполнена без ощибок
false - ошибка в функции
</result>
<others>
warning!!! used WinAPI
</others>
</information>
%END REM
On Error Goto ErrorHandler
GetModuleName = False
ModuleName = String (256, Chr (0))
'0 = current module
Call GetModuleFileName (0, ModuleName, Len(ModuleName))
moduleName = Mid (ModuleName, 1, Instr (1, ModuleName, Chr (0), 0) - 1)
GetModuleName = True
Ex:
Exit Function
ErrorHandler:
Call ProcessError (LIB_NAME, Err, Error, Erl, Lsi_info (2), Lsi_info (12))
Resume Ex
End Function