@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: TODO - a short description The example given previously was incorrect - the cStr member should be an array of MAX_PATH (260) bytes, not a single IntPtr. I've added the Size=264 parameter to the StructLayout attribute to make this work. I know this is right in C#, have no idea about VB. !!!!C# Definition: [StructLayout(LayoutKind.Explicit, Size=264)] public struct STRRET { [FieldOffset(0)] public UInt32 uType; // One of the STRRET_* values [FieldOffset(4)] public IntPtr pOleStr; // must be freed by caller of GetDisplayNameOf [FieldOffset(4)] public IntPtr pStr; // NOT USED [FieldOffset(4)] public UInt32 uOffset; // Offset into SHITEMID [FieldOffset(4)] public IntPtr cStr; // Buffer to fill in (ANSI) } !!!!VB Definition: <StructLayout(LayoutKind.Explicit, Size=264)> _ Public Structure STRRET <FieldOffset(0)> Public uType As UInt32 'One of the STRRET_* values <FieldOffset(4)> Public pOleStr As IntPtr 'must be freed by caller of GetDisplayNameOf <FieldOffset(4)> Public pStr As IntPtr 'NOT USED <FieldOffset(4)> Public uOffset As UInt32 'Offset into SHITEMID <FieldOffset(4)> Public cString As IntPtr 'Buffer to fill in (ANSI) End Structure !!!!User-Defined Field Types: None. !!!!Notes: Example: // Structure used to return the display name to STRRET pDisplayName; String DisplayName; SHFILEINFO m_shfi = new SHFILEINFO(); // Request the string as a char although Windows will likely ignore // the request. pDisplayName.uType = (uint)STRRET_TYPE.STRRET_CSTR; // Get the "normal" display name. iShellFolder.GetDisplayNameOf(pidlItems[0], SHGNO.SHGDN_NORMAL, out pDisplayName); System.Text.StringBuilder sbDisplayName = new System.Text.StringBuilder(256); // Get the display name from the STRRET structure WindowsAPI.StrRetToBuf(ref pDisplayName, pidlItems[0], sbDisplayName, (uint)sbDisplayName.Capacity); DisplayName = sbDisplayName.ToString(); Documentation: STRRET@msdn on MSDN !!!!Question These codes are correct in 64bit platforms? The size of STRRET sturctre in 64bit is 272 bytes.
Edit Structures.STRRET
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.