Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/145.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++ 在Windows中通过RPC发送UDT_C++_Windows_Winapi_Rpc_Idl - Fatal编程技术网

C++ 在Windows中通过RPC发送UDT

C++ 在Windows中通过RPC发送UDT,c++,windows,winapi,rpc,idl,C++,Windows,Winapi,Rpc,Idl,我开始在Windows中使用RPC,我有一个基本的客户机/服务器模型设置和工作,我可以在2之间传递一个字符串,好的,但我现在需要扩展它,在2之间传递一个二进制结构,我不知道如何。显然,试图传递一个void*不会起作用,因为MIDL编译器不知道结构的大小,但我希望有一种方法可以在IDL中定义一个结构来实现这一点。我当前的IDL如下所示: [uuid("1D51414D-150C-4F4C-8742-0C08AFBE409E"), version(1.0)] interface RpcVendor

我开始在Windows中使用RPC,我有一个基本的客户机/服务器模型设置和工作,我可以在2之间传递一个字符串,好的,但我现在需要扩展它,在2之间传递一个二进制结构,我不知道如何。显然,试图传递一个void*不会起作用,因为MIDL编译器不知道结构的大小,但我希望有一种方法可以在IDL中定义一个结构来实现这一点。我当前的IDL如下所示:

[uuid("1D51414D-150C-4F4C-8742-0C08AFBE409E"), version(1.0)]
interface RpcVendor
{
    void SendMessage([in] handle_t hBinding, [in, string] char *message);
}
struct {
    char *title;
    char *message;
    int type;
}
我的结构是这样的:

[uuid("1D51414D-150C-4F4C-8742-0C08AFBE409E"), version(1.0)]
interface RpcVendor
{
    void SendMessage([in] handle_t hBinding, [in, string] char *message);
}
struct {
    char *title;
    char *message;
    int type;
}
有没有办法在IDL中定义并传递它

谢谢,
J

您的对象有两个字符串和一个int。您可以在IDL源文件中定义这样的对象,并在编译器吐出必要的存根后传递它们


开始阅读。

谢谢,这正是我所希望的。如何在IDL源文件中定义对象?我一直在浏览MSDN站点,我能找到的唯一信息是关于定义函数而不是对象的。