>[DllImport("olepro32.dll", SetLastError=true)]
>internal static extern int OleCreatePictureIndirect(ref PICTDESC pPictDesc,
[quoted text clipped - 6 lines]
> public long hpal;
> };
Your PICTDESC structure declaration is incorrect. Try it like this
instead.
[DllImport("olepro32.dll", PreserveSig=false)]
internal static extern void OleCreatePictureIndirect(ref PICTDESC
pPictDesc, ref System.Guid riid, bool fOwn, out stdole.IPictureDisp
ppvObj);
internal struct PICTDESC{
public int cbSizeOfStruct;
public int picType;
public IntPtr hPic;
public IntPtr hpal;
public int _pad;
};
> pd.cbSizeOfStruct = 144;//Marshal.SizeOf(pd);
The structure size is definitely not 144 bytes. You better use
Marshal.SizeOf instead.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Liu Qian - 27 Aug 2003 02:15 GMT
OK, Thanks Mattias.
The code worked correctlly, thank you very much.
chian
> >[DllImport("olepro32.dll", SetLastError=true)]
> >internal static extern int OleCreatePictureIndirect(ref PICTDESC pPictDesc,
[quoted text clipped - 29 lines]
>
> Mattias