http://pinvoke.net/default.aspx/kernel32.GetModuleFileName

then find msdn
Module.FullyQualifiedName 屬性 [C#]請參閱
Module 類別 | Module 成員 | System.Reflection 命名空間 | Module 成員 (Visual J# 語法) | Managed Extensions for C++ 程式設計
需求
平台: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) 標準

.NET Framework 安全性:

FileIOPermission- 用來存取路徑中的資訊。相關列舉型別: FileIOPermissionAccess.PathDiscovery 。
語言
C#

C++

JScript

Visual Basic

全部顯示
取得表示這個模組完整名稱和路徑的字串。

[Visual Basic]
Public Overridable ReadOnly Property FullyQualifiedName As String

[C#]
public virtual string FullyQualifiedName {get;}

[C++]
public: __property virtual String* get_FullyQualifiedName();

[JScript]
public function get FullyQualifiedName() : String;

屬性值
完整的模組名稱。

例外狀況
例外狀況類型 條件
SecurityException 呼叫端沒有所要求的使用權限。

備註
若要取得名稱而不要路徑,請使用 Name 。

如果這個模組的組件是從位元組陣列載入的,那麼模組的 FullyQualifiedName 將會是:。

注意 模組名稱的大小寫與平台相依。
範例
[Visual Basic, C#, C++] 下列範例會顯示指定模組的完整名稱。

[Visual Basic]
Imports System
Imports System.Reflection

Namespace ReflectionModule_Examples
Class MyMainClass
Shared Sub Main()
Dim moduleArray() As [Module]

moduleArray = [Assembly].GetExecutingAssembly().GetModules(False)

' In a simple project with only one module, the module at index
' 0 will be the module containing this class.
Dim myModule As [Module] = moduleArray(0)

Console.WriteLine("myModule.FullyQualifiedName = {0}", myModule.FullyQualifiedName)
End Sub 'Main
End Class 'MyMainClass
End Namespace 'ReflectionModule_Examples

[C#]
using System;
using System.Reflection;

namespace ReflectionModule_Examples
{
class MyMainClass
{
static void Main()
{
Module[] moduleArray;

moduleArray = Assembly.GetExecutingAssembly().GetModules(false);

// In a simple project with only one module, the module at index
// 0 will be the module containing this class.
Module myModule = moduleArray[0];

Console.WriteLine("myModule.FullyQualifiedName = {0}", myModule.FullyQualifiedName);
}
}
}

[C++]
#using

using namespace System;
using namespace System::Reflection;

void main()
{
Module* moduleArray[];

moduleArray = Assembly::GetExecutingAssembly()->GetModules(false);

// In a simple project with only one module, the module at index
// 0 will be the module containing this class.
Module* myModule = moduleArray[0];

Console::WriteLine(S"myModule.FullyQualifiedName = {0}", myModule->FullyQualifiedName);
}

[JScript] 沒有可供 JScript 使用的範例。若要檢視 Visual Basic、C# 或 C++ 範例,請按一下畫面左上角的 [語言篩選條件] 按鈕 。

需求
平台: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) 標準

.NET Framework 安全性:

FileIOPermission- 用來存取路徑中的資訊。相關列舉型別: FileIOPermissionAccess.PathDiscovery 。
請參閱
Module 類別 | Module 成員 | System.Reflection 命名空間 | Module 成員 (Visual J# 語法) | Managed Extensions for C++ 程式設計


--------------------------------------------------------------------------------

提供這個主題的相關建議

© 2001-2002 Microsoft Corporation. All rights reserved.

文章標籤
全站熱搜
創作者介紹
創作者 kylin25 的頭像
kylin25

打混中

kylin25 發表在 痞客邦 留言(0) 人氣(45)