![]() You need to download and use the latest version from its project home for this to work. sample code you have linked to appears to be using, which is written by Weixi Yen. using the Com IDataObject interface get the data using the defined FORMATETC create STGMEDIUM to output request results into create a FORMATETC struct to request the data withįormatetc.cfFormat = (short)DataFormats.GetFormat(format).Id įormatetc.dwAspect = DVASPECT.DVASPECT_CONTENT įormatetc.tymed = TYMED.TYMED_ISTREAM | TYMED.TYMED_ISTORAGE | TYMED.TYMED_HGLOBAL Public MemoryStream GetData(string format, int index) / A containing the raw data for the specified data format at the specified index. / Retrieves the data associated with the specified data format at the specified index. loop for the number of files acording to the file group descriptorįor(int fileDescriptorIndex = 0 fileDescriptorIndex IntPtr fileDescriptorPointer = (IntPtr)((int)fileGroupDescriptorAPointer + Marshal.SizeOf(fileGroupDescriptor.cItems)) get the pointer to the first file descriptor create a new array to store file names in of the number of items in the file group descriptor NativeMethods.FILEGROUPDESCRIPTORA fileGroupDescriptor = (NativeMethods.FILEGROUPDESCRIPTORA)fileGroupDescriptorObject ![]() Object fileGroupDescriptorObject = Marshal.PtrToStructure(fileGroupDescriptorAPointer, typeof(NativeMethods.FILEGROUPDESCRIPTORA)) marshal the unmanaged memory to to FILEGROUPDESCRIPTORA struct Marshal.Copy(fileGroupDescriptorBytes, 0, fileGroupDescriptorAPointer, fileGroupDescriptorBytes.Length) copy the file group descriptor into unmanaged memoryįileGroupDescriptorAPointer = Marshal.AllocHGlobal(fileGroupDescriptorBytes.Length) MemoryStream fileGroupDescriptorStream = (MemoryStream)("FileGroupDescriptor", autoConvert) īyte fileGroupDescriptorBytes = new byte įileGroupDescriptorStream.Read(fileGroupDescriptorBytes, 0, fileGroupDescriptorBytes.Length) use the underlying IDataObject to get the FileGroupDescriptor as a MemoryStream IntPtr fileGroupDescriptorAPointer = IntPtr.Zero Public object GetData(string format, bool autoConvert) This.getDataFromHGLOBLALMethod = ().GetMethod("GetDataFromHGLOBLAL", BindingFlags.NonPublic | BindingFlags.Instance) This.oleUnderlyingDataObject = ()innerDataField.GetValue(this.underlyingDataObject) UnderlyingDataObject = (.IDataObject)this.underlyingDataObject įieldInfo innerDataField = ().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance) This.underlyingDataObject = underlyingDataObject ![]() Public OutlookDataObject( underlyingDataObject) Private MethodInfo getDataFromHGLOBLALMethod Private .IDataObject comUnderlyingDataObject / Holds the that this class is wrapping Void Stat(out .STATSTG pstatstg, int grfStatFlag) Void UnlockRegion( long libOffset, long cb, int dwLockType) Void LockRegion( long libOffset, long cb, int dwLockType) Void WriteAt( long ulOffset, IntPtr pv, int cb, int pcbWritten) Void ReadAt( long ulOffset, byte pv, int cb, int pcbRead) Void Stat(out .STATSTG pStatStg, int grfStatFlag) Void SetStateBits(int grfStateBits, int grfMask) ![]() Void SetElementTimes( string pwcsName, .FILETIME pctime, .FILETIME patime, .FILETIME pmtime) Void RenameElement( string pwcsOldName, string pwcsNewName) Void EnumElements( int reserved1, IntPtr reserved2, int reserved3, out object ppVal) Void MoveElementTo( string pwcsName, IStorage stgDest, string pwcsNewName, int grfFlags) Void CopyTo(int ciidExclude, Guid pIIDExclude, IntPtr snbExclude, IStorage stgDest) IStorage OpenStorage( string pwcsName, IntPtr pstgPriority, int grfMode, IntPtr snbExclude, int reserved) IStorage CreateStorage( string pwcsName, int grfMode, int reserved1, int reserved2) IStream OpenStream( string pwcsName, IntPtr reserved1, int grfMode, int reserved2) IStream CreateStream( string pwcsName, int grfMode, int reserved1, int reserved2) Public static extern IStorage StgCreateDocfileOnILockBytes(ILockBytes plkbyt, uint grfMode, uint reserved) Public static extern IntPtr GetHGlobalFromILockBytes(ILockBytes pLockBytes) Public static extern ILockBytes CreateILockBytesOnHGlobal(IntPtr hGlobal, bool fDeleteOnRelease) Static extern IntPtr GlobalLock(IntPtr hMem) I solve my problem Just add that code in any cs file.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |