Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# IntPtr到事件 < >我使用C++中的函数,它返回了一个我需要的事件句柄。我以前从未使用过句柄,在进入实际事件时遇到了一些问题。我是这样导入的: [DllImport("Some.dll")] private static extern IntPtr eventCapturedCreate(int argument);_C#_Dllimport_Handle - Fatal编程技术网

C# IntPtr到事件 < >我使用C++中的函数,它返回了一个我需要的事件句柄。我以前从未使用过句柄,在进入实际事件时遇到了一些问题。我是这样导入的: [DllImport("Some.dll")] private static extern IntPtr eventCapturedCreate(int argument);

C# IntPtr到事件 < >我使用C++中的函数,它返回了一个我需要的事件句柄。我以前从未使用过句柄,在进入实际事件时遇到了一些问题。我是这样导入的: [DllImport("Some.dll")] private static extern IntPtr eventCapturedCreate(int argument);,c#,dllimport,handle,C#,Dllimport,Handle,我在这一点上尝试过的任何事情都没有成功。我的一般方法是使用Marshal.PtrToStructure,但我不确定要指定什么类型 如有任何见解,将不胜感激 您不会将事件句柄转换为结构。它是一个不透明的值。事件句柄被传递给作为参数接收句柄的其他函数,如SetEvent、ResetEvent、WaitForSingleObject等 跟踪IntPtr中的句柄值,并将该值传递给需要事件句柄的任何其他函数 我不确定我会把这个把手传给什么人。我正在编写C#,只是想设置一个事件处理程序。谢谢我想我们谈论的是

我在这一点上尝试过的任何事情都没有成功。我的一般方法是使用Marshal.PtrToStructure,但我不确定要指定什么类型


如有任何见解,将不胜感激

您不会将事件句柄转换为结构。它是一个不透明的值。事件句柄被传递给作为参数接收句柄的其他函数,如
SetEvent
ResetEvent
WaitForSingleObject


跟踪
IntPtr
中的句柄值,并将该值传递给需要事件句柄的任何其他函数

我不确定我会把这个把手传给什么人。我正在编写C#,只是想设置一个事件处理程序。谢谢我想我们谈论的是不同的事情。在Windows上,事件句柄是一个定义良好的东西。与事件处理程序无关。我不确定该如何处理该链接。你可能在你的头上。