从 C++ 转换回调函数到 VB.Net
我正在尝试将 C++ API 转换为 VB.Net,但这个功能太难了,我不知道如何使其工作。
以下是该函数的 API 文档:
void RemoteDllSetReceiver(void *inst, on_received_buffer_t received_buf_cb);
设置回调函数以接收来自 DLL 的通知。回调的原型是:
typedef bool (*on_received_buffer_t)(void* inst, const unsigned char *buffer, unsigned int size);
其中
- 指针
- inst是最初传递给RemoteDllSetReceiver buffer &的 。 size 包含远程协议中定义的通知文本。
注意:通知可能会到达不同的线程(例如网络、计时器、音频)。
我无法想象我必须对 on_received_buffer_t 做什么,它必须是委托吗?正如您所读到的,该函数从 DLL 返回通知,例如连接状态、用户 ID...
任何帮助将不胜感激,谢谢。
I'm trying to convert C++ API to VB.Net, but this function is too hard and i don't know how make it work.
Here is the API doc for this function:
void RemoteDllSetReceiver(void *inst, on_received_buffer_t received_buf_cb);
Sets a callback function to receive notifications from the DLL. The prototype of the callback is:
typedef bool (*on_received_buffer_t)(void* inst, const unsigned char *buffer, unsigned int size);
Where
- inst is the pointer originally passed to RemoteDllSetReceiver
- buffer & size contain the notification text as defined in the Remote Protocol.
Note: notifications may arrive in different threads (e.g. network, timer, audio).
I can't imagine what i mus do with on_received_buffer_t, must it be a delegate? Like you can read, this functions returns notifications from the DLL like connection status, user id...
Any help will be appreciated, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我必须补充一点,我正在使用 Visual Studio 2008 和 Compact Framework 3.5。我当前的工作是:
P/Invoke 函数:
received_buffer_t 的委托
我在代码中调用它:
ReceiveMessage 函数:
谢谢
I must add that i'm using Visual Studio 2008 and Compact Framework 3.5. My current work is:
P/Invoke Function:
Delegate for received_buffer_t
And I call it in my code:
ReceiveMessage Function:
Thanks