Ok, I think I sent this last email too quickly. If I try to use the PROPVARIANT struct as defined, it blows up on me when the type is loaded.
An unhandled exception of type 'System.TypeLoadException' occurred in felix.dll Additional information: Could not load type PROPVARIANT from assembly Everything compiles correctly, so I'm not sure where the problem could be. Anyone? [StructLayout(LayoutKind.Explicit)] struct PROPVARIANT { [FieldOffset(0)] short vt; [FieldOffset(2)] short wReserved1; [FieldOffset(4)] short wReserved2; [FieldOffset(6)] short wReserved3; [FieldOffset(8)] sbyte cVal; [FieldOffset(8)] byte bVal; [FieldOffset(8)] short iVal; [FieldOffset(8)] ushort uiVal; [FieldOffset(8)] int lVal; [FieldOffset(8)] uint ulVal; [FieldOffset(8)] long hVal; [FieldOffset(8)] ulong uhVal; [FieldOffset(8)] float fltVal; [FieldOffset(8)] double dblVal; [MarshalAs(UnmanagedType.Currency), FieldOffset(8)] decimal cyVal; [FieldOffset(8)] DateTime date; [MarshalAs(UnmanagedType.VariantBool)] [FieldOffset(8)] bool boolVal; [MarshalAs(UnmanagedType.Error)] [FieldOffset(8)] int scode; [FieldOffset(8)] FILETIME filetime; [FieldOffset(8)] IntPtr everything_else; } The SDK definition is here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/stgrstr c_0uwk.asp Thanks, Erick ----- Original Message ----- From: "Erick Thompson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 14, 2002 5:17 PM Subject: Re: [DOTNET] RCW for IFilter and LoadIFilter > Mattias, > > Thanks, this looks great. I should have thought of the everything_else > pointer. It certainly saves a lot of work :) > > Erick > > ----- Original Message ----- > From: "Mattias Sjögren" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, May 14, 2002 2:15 PM > Subject: Re: [DOTNET] RCW for IFilter and LoadIFilter > > > Erick, > > >Now, the PROPVARIANT is a huge mess of an object, and it appears under the > >general COM section of the SDK. I assume that it's related to the VB > variant > >datatype. Is there a .net version/wrapper for this struct already defined > >somewhere? > > > Try this > > [StructLayout(LayoutKind.Explicit)] > struct PROPVARIANT > { > [FieldOffset(0)] public short vt; > [FieldOffset(2)] public short wReserved1; > [FieldOffset(4)] public short wReserved2; > [FieldOffset(6)] public short wReserved3; > [FieldOffset(8)] public sbyte cVal; > [FieldOffset(8)] public byte bVal; > [FieldOffset(8)] public short iVal; > [FieldOffset(8)] public ushort uiVal; > [FieldOffset(8)] public int lVal; > [FieldOffset(8)] public uint ulVal; > [FieldOffset(8)] public long hVal; > [FieldOffset(8)] public ulong uhVal; > [FieldOffset(8)] public float fltVal; > [FieldOffset(8)] public double dblVal; > [MarshalAs(UnamangedType.Currency)] > [FieldOffset(8)] public decimal cyVal; > [FieldOffset(8)] public DateTime cyVal; > [MarshalAs(UnamangedType.VariantBool)] > [FieldOffset(8)] public bool boolVal; > [MarshalAs(UnamangedType.Error)] > [FieldOffset(8)] public int scode; > [FieldOffset(8)] public FILETIME filetime; > > [FieldOffset(8)] public IntPtr everything_else; > } > > > > Mattias > > === > Mattias Sjögren > [EMAIL PROTECTED] > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.