//定义一个委托 public delegate void RemoteConfigCallback(uint dwType, IntPtr lpBuffer, uint dwBufLen, IntPtr pUserData); //定义一个函数 private void ProcessUserInfoSearchCallback(uint dwType, IntPtr lpBuffer, uint dwBufLen, IntPtr pUserData) { MessageBox.Show("run test"); } private void button1_Click(object sender, EventArgs e) { RemoteConfigCallback callback = ProcessUserInfoSearchCallback; //大概是把函数地址赋值给 委托 callback = new RemoteConfigCallback(ProcessUserInfoSearchCallback); //调用委托 callback.Invoke(0, IntPtr.Zero, 0, IntPtr.Zero); // 使用委托对象调用方法 callback(0, IntPtr.Zero, 0, IntPtr.Zero);