2011-06-27 7 views
-1
Error C3352: 'void ServerClass::ActionMethod(int,int,System::String ^)' : 

をデリゲート型「のボイド(ボイド)」と一致しません指定された関数は、デリゲート型「のボイド(空洞)D」と一致しません。 70 1 win32projectは、指定された関数は

つまり、win32アプリケーションはC#ライブラリを使用しています。 Win32アプリケーションがC#ライブラリのコンストラクタメソッドを呼び出すと、上記のエラーが表示されます。以下はコードです。私は何が欠けているのか分かりません。

Win32アプリケーションコード

ヘッダファイル

public ref class ServerClass 
{ 
NetEvents::NetEventArgs^ args; 
NetSockets::NetSocket^ server; 
public: 
void ActionMethod(int iCommand, int iClientIndex, System::String^ message); 
void StartServer(); 
}; 

ソースファイル

void ServerClass::ActionMethod(int iCommand, int iClientIndex, System::String^ message) 
{ 

} 

void ServerClass::StartServer() 
{ 
server = gcnew NetSockets::NetSocket(gcnew System::Action(this, &ServerClass::ActionMethod1)); 
} 

C#ライブラリコード

namespace NetSockets 
{ 
public class NetSocket 
{ 
    Action<int,int,string> actClient; 

    public NetSocket(Action<int, int, int> action) 
    { 

    } 

    public NetSocket(Action<int, int, string> action) 
    { 
     this.actClient = action; 
    } 
} 
} 
+0

スティーブ:誰もあなたに直接メールを送信しません。ここで確認してください。 – NotMe

+0

の可能な複製[Win32アプリケーションのC++メソッドのアドレスをAC#メソッドに渡して、アクションデリゲートパラメータメソッドで渡すにはどうすればいいですか?](http://stackoverflow.com/questions/6486272/how-do-i-pass-the -add-of-ac-method-in-win32-app-to-ac-method-with-action) –

答えて

2

System.Actionデリゲートは、voidを返すパラメータを持たないデリゲート型です。

エラーメッセージに示されているように、機能がそれと一致しません。

Action<int, int, string>などの異なる代理人タイプを使用する必要があります。

関連する問題