VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Find FULL App Path + App Extension

by Steve Sellers (1 Submission)
Category: VB function enhancement
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

This simple 10 lines of code (including 1 API call) will return the FULL application path INCLUDING the application extension. Very easy to use. Tired of using App.path & "\" & app.exename & ".exe" when you dont know for sure that your extention will be .exe? This will return it all. Votes are welcome

Inputs
Just call FullAppName instead of putting in App.path & "\" & app.exename & ".exe"
Assumes
Simply place the API Code and the function in your project. Use FullAppName every time you refer to your self in your code.
Code Returns
A string containing the full application path and extention
Side Effects
No Side Affects

Rate Find FULL App Path + App Extension

Private Declare Function GetModuleFileName Lib "kernel32" _
 Alias "GetModuleFileNameA" (ByVal hModule As Long, _
 ByVal lpFileName As String, ByVal nSize As Long) As Long
Public Function FullAppName() As String
 Dim modName As String * 256
 Dim i As Long
 i = GetModuleFileName(App.hInstance, modName, Len(modName))
 FullAppName = Left$(modName, i)
End Function

Download this snippet    Add to My Saved Code

Find FULL App Path + App Extension Comments

No comments have been posted about Find FULL App Path + App Extension. Why not be the first to post a comment about Find FULL App Path + App Extension.

Post your comment

Subject:
Message:
0/1000 characters