Help required about structure in COM .IDL file
hello,
i am using COM in my project.
i wand to used CLSCTX_LOCAL_SERVER for COM and using structre HD_DISK_GEOMETRY like this
[id(51), helpstring("method SetDiskGeometry")] HRESULT(SetDiskGeometry)([in]HD_DISK_GEOMETRY* DiskGeom);
But MIDl compiler creates an error of this statement that is
error MIDL2025 : syntax error : expecting a type specification near "HD_DISK_GEOMETRY"
Plz help me to remove this error
Regards
# 1 Re: Help required about structure in COM .IDL file
Of course it does, since there was no this sructure defined in includes or your IDL. You must create this definition before referencing it.
BTW, never heard before about HD_DISK_GEOMETRY structure.
# 2 Re: Help required about structure in COM .IDL file
Yes its a user defiend structure, i use this structure in other classes but when i want to refer it in .IDl file then it create this error.
i need some guide related this issue, how can i refer the user defined structure when i use the following flags to create process.
"CLSCTX_INPROC_SERVER
CoCreateInstance( " in the same process
"CLSCTX_LOCAL_SERVER
CoCreateInstance( " in out of the process
Plz guide me
# 3 Re: Help required about structure in COM .IDL file
You need to declare the structure in the .idl file:
e.g.
struct HD_DISK_GEOMETRY
{
LONG param1;
LONG param2;
};
library
{
//other IDL contents here
};
# 4 Re: Help required about structure in COM .IDL file
Thanks,
But this way is useful when i am using "CLSCTX_INPROC_SERVER" to "CoCreateInstance( "
Now i am usinf "CLSCTX_LOCAL_SERVER" to "CoCreateInstance( " in my project and i think IStream support to do that, but still i cant find the way how can i use IStream ?
Regards
# 5 Re: Help required about structure in COM .IDL file
The structure usage and what you pass to CoCreateInstance are unrelated. Why do you think it has a dependency on CLSTCS_*_SERVER value you pass in ?
# 6 Re: Help required about structure in COM .IDL file
When the COM is in the same process then the structre reference is valid.
When the COM is created in Out of process then the structure refrence is not working.
I think i must use the IStream to write structure and read the structure.
But not get the rite way to do this.
TC
CLSCTX_LOCAL_SERVER
# 7 Re: Help required about structure in COM .IDL file
When the COM is in the same process then the structre reference is valid.
When the COM is created in Out of process then the structure refrence is not working.Show us your type library - it must include that structure declaration to let that structure to be exposed in other process build environment. Afraid, your structure declaration in IDL does not follow the standard COM rules for such case. :)