Vb.Net取得DLL的呼叫者 (Get Vb.net Dll Caller)
Imports System.Reflection
Public Class Class1
Public Function GetCallingAppName()
'取得自己
'Get Myself Assembly Name
'Dim asm As Assembly = Assembly.GetExecutingAssembly()
'Dim location As String = asm.Location
'Dim appName As String = System.IO.Path.GetFileName(location)
'取得呼叫者
'Get Calling Assembly Name
Dim asm As Assembly = Assembly.GetCallingAssembly
Dim location As String = asm.Location
Dim appName As String = System.IO.Path.GetFileName(location)
'取得眾多呼叫者的第一位(最早的)
'Get Calling First Assembly Name(Earliest)
'Dim asm As Assembly = Assembly.GetEntryAssembly
'Dim location As String = asm.Location
'Dim appName As String = System.IO.Path.GetFileName(location)
Return appName
End Function
End Class
2011年5月3日 星期二
訂閱:
張貼留言 (Atom)





沒有留言:
張貼留言