|
-
Aug 24th, 2001, 04:32 AM
#1
Thread Starter
New Member
Make an EXE get its own EXE name?
Ok, sounds simple.. use app.EXEname
Trouble is that doesn't work if the user changes the exe file from what it was originaly. For instance, I compile an exe called blabla.exe, now thats fixed as app.EXEname, so if a user changes the exe name to albalb.exe - app.EXEname will still see it as blabla.exe
Anyhows, I need my program to work with the exe when its run. The first thing the program needs to know is what its own name is.. can someone suggest how to do this?
Many Thanks...
-
Aug 24th, 2001, 05:06 AM
#2
Addicted Member
This returns the path + filename of the App. containing this function:
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String ) As Long
Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long ,ByVal lpFileName As String ,ByVal nSize As Long ) As Long
Function ExeName() As String
Dim Name As String
Dim hWnd As Long
Name = Space$(255)
hWnd = GetModuleHandle(vbNullString)
GetModuleFileName hWnd, Name, 255
ExeName = Name
End Function
-
Aug 24th, 2001, 06:49 AM
#3
Thread Starter
New Member
Thank you so much for your help, that worked perfect. Very much appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|