GetModuleFileNameA (Kernel32)



Usage

    Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Integer, ByVal lpFileName As String, ByVal nSize As Integer) As Integer

        Dim MAX_PATH As Integer = 260
        Dim szExePath As String, lCnt As Integer

        szExePath = StrDup(MAX_PATH, vbNullChar)
        lCnt = GetModuleFileName(0, szExePath, MAX_PATH)
        szExePath = Microsoft.VisualBasic.Left(szExePath, lCnt)