F_GET_NAME_AND_PATH_APPLICATION

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name : f_get_name_and_path_application
// Argument Name : (None)
// Return Type :      String
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Local External Functions :
// Function Long GetModuleFileName (Long hModule, ref String lpFileName, Long nSize)
// Library 'kernel32.dll' Alias For GetModuleFileNameA
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

String ls_AppPath
String ls_FullPath
String ls_Exe
Integer li_Return
Integer li_Pos

ls_FullPath = Space (255)
li_Return = GetModuleFileNameA (Handle (GetApplication ()), ls_FullPath, 255)

If li_Return  > 0 Then
    Do While (Pos (ls_FullPath, "\", li_Pos + 1) > 0)
        li_Pos = Pos (ls_FullPath, "\", li_Pos + 1)
    Loop
   
    ls_AppPath = Mid (ls_FullPath, 1, li_pos - 1)
    ls_Exe = Mid (ls_FullPath, li_Pos + 1)
End If

Return ls_AppPath

0 comments:

Post a Comment