Search Tools Links Login

Find FULL App Path + App Extension!


Visual Basic 6, or VB Classic

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

Original Author: Steve Sellers

Inputs

Just call FullAppName instead of putting in App.path & "" & app.exename & ".exe"

Assumptions

Simply place the API Code and the function in your project. Use FullAppName every time you refer to your self in your code.

Returns

A string containing the full application path and extention

Side Effects

No Side Affects

Code

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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 104 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.