冰楓論壇
標題:
[C#] 取得執行檔的執行實體名稱
[打印本頁]
作者:
whitefox
時間:
2023-6-25 23:32
標題:
[C#] 取得執行檔的執行實體名稱
這個例子使用反射方法達成
string sExeFile = @"C:\Windows\notepad.exe";
Assembly assebly = Assembly.LoadFrom(sExeFile);
Module module = assebly.ManifestModule;
Type[] types = module.GetTypes();
Type tpForm = typeof(Form);
foreach (Type type in types)
{
if (type.IsSubclassOf(tpForm))
{
MessageBox.Show(type.FullName);
}
}
複製代碼
歡迎光臨 冰楓論壇 (https://bingfong.com/)
Powered by 冰楓