Hi,

I am writing some code to Interop with COM=2E I have to=
determine the parameters of COM function and I am using=
FUNCDESC structure from typelibrary=2E My question is how to=
marshal the lprgelemdescParam array structures=2E I have the=
following code from another post in dotnet247=2E

What I am trying to do is to print the function declaration=
defined by FUNCDESC structure in =2Enet=2E Has anyone done this ?






IntPtr ElementDescriptionArrayPtr =3D funcdesc=2ElprgelemdescParam;

int ElementDescriptionSize =3D Marshal=2ESizeOf(new=
COM=2EELEMDESC()=2EGetType());



for (int i =3D 0; i < funcdesc=2EcParams; i++)

{



COM=2EELEMDESC ElementDescription;

int ElementDescriptionAddress;

int ElementDescriptionArrayByteOffset;

IntPtr ElementDescriptionPointer;



ElementDescription =3D new COM=2EELEMDESC();

ElementDescriptionArrayByteOffset =3D i *=
ElementDescriptionSize;

ElementDescriptionAddress =3D=
ElementDescriptionArrayPtr=2EToInt32();

ElementDescriptionAddress +=3D=
ElementDescriptionArrayByteOffset;

ElementDescriptionPointer =3D=
(IntPtr)(ElementDescriptionAddress);

ElementDescription =3D=
(COM=2EELEMDESC)(Marshal=2EPtrToStructure(ElementDescriptionPointer,=


=
typeof(COM=2EELEMDESC)));



string paramstring =3D=
GetStringFromTypeDesc(typeinfo, ElementDescription=2Etdesc);

builder=2EAppend(paramstring);



if (i < funcdesc=2EcParams - 1)

{

builder=2EAppend(", ");

}



}





Is this the correct way to do this ? I am not sure if I am=
getting correct values back when I executed the above code? I=
would appreciate any help on how to marshal an array of=
unmanaged structure into a managed array of structures=2E







Thanks

-Arul



--------------------------------
From: amags kumar

-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)

<Id>W5ImLKlkBk2TMJmjnBXagQ=3D=3D</Id>