devxlogo

GetAppFilename – Return the application’s file name and path

GetAppFilename – Return the application’s file name and path

Private Declare Function GetModuleFileName Lib "kernel32" Alias _    "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, _    ByVal nSize As Long) As LongPrivate Declare Function GetModuleHandle Lib "kernel32" Alias _    "GetModuleHandleA" (ByVal lpModuleName As String) As Long' return the application's filename'' it is similar to App.Path+App.ExeName, but it also' works when the program is run on a remote workstation' (in that case App.Path sometimes fails)'' In interpreted mode it returns the VB5 or VB6 executable filenameFunction GetAppFilename() As String    Dim hModule As Long    Dim buffer As String * 256        ' get the handle of the running application    hModule = GetModuleHandle(App.EXEName)    ' get the filename corresponding to that handle    GetModuleFileName hModule, buffer, Len(buffer)    GetAppFilename = Left$(buffer, InStr(buffer & vbNullChar, vbNullChar) - 1)End Function

See also  lenso.ai - an AI reverse image search platform
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist