|
-
Aug 30th, 2000, 03:46 AM
#1
Thread Starter
Lively Member
How do I get the EXEname in a DLL from the one calling it ?
I want it to be able to do a log in the Event Log
Yesterday, all my troubles seemed so far away...
Help, I need somebody, Help...
Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.
-
Aug 30th, 2000, 05:42 AM
#2
Simply call the GetModuleFileName. This API function returns the path and name for the file that created the calling process when you pass NULL as the module handle.
Code:
Private Declare Function GetModuleFileName _
Lib "kernel32" Alias "GetModuleFileNameA" ( _
ByVal hModule As Long, _
ByVal lpFileName As String, _
ByVal nSize As Long) As Long
Private Function GetCallerName() As String
Dim sAppPath As String
Const MAX_PATH = 260
sAppPath = Space$(MAX_PATH)
GetModuleFileName 0&, sAppPath, MAX_PATH
sAppPath = Left$(sAppPath, InStr(sAppPath, vbNullChar) - 1)
GetCallerName = sAppPath
End Function
Good luck!
-
Aug 30th, 2000, 09:27 AM
#3
Thread Starter
Lively Member
Thanks Joacim, you always has an answer.
I get VB6.EXE in the IDE but the rigth name then it is compiled ! Thanks again.
Yesterday, all my troubles seemed so far away...
Help, I need somebody, Help...
Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.
-
Aug 30th, 2000, 10:28 AM
#4
Originally posted by AKA
Thanks Joacim, you always has an answer.
I get VB6.EXE in the IDE but the rigth name then it is compiled ! Thanks again.
I'm not sure I understood that last part but your welcome.
-
Aug 30th, 2000, 10:33 AM
#5
Thread Starter
Lively Member
I meant the folowing :
In the IDE I get VB6.EXE as the file doing the call from GetModuleFileName but then I compile my program I get my own program name.
Yesterday, all my troubles seemed so far away...
Help, I need somebody, Help...
Now MCSD and still locking for intresting job in the south parts of Stockholm, Sweden.
-
Aug 30th, 2000, 10:41 AM
#6
Oh yeah, of course, I should have mentioned that.
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
|