我想在C#中創建一個dll文件,該文件具有一個調用Application.AddMessageFilter()的Win表單加載此DLL的靜態方法。如何調用DLL中的Application.AddMessageFilter
例如,
public Form1()
{
// initializing
MyDll.InvokeFilter(SomeClass); // Perfect!
}
而且我不希望它看起來像如下,(我甚至不認爲這個代碼將正常工作,雖然)
public Form1()
{
// initializing
// Send also the delegate to Application.AddMessageFilter as a parameter
// to let MyDll know it, which is not as good.
MyDll.InvokeFilterWithDelegate(SomeClass, Application.AddMessageFilter);
}
的事情是我不知道如何從我的Dll文件調用Application.AddMessageFilter,因爲Application類屬於Form1,而不是我的Dll庫。
我錯過了什麼?
在此先感謝。
非常感謝! – 2012-07-27 01:43:31