> For the complete documentation index, see [llms.txt](https://pinvokeisalive.gitbook.io/pinvoke/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pinvokeisalive.gitbook.io/pinvoke/directory/structures/strret.md).

# STRRET

### C# Definition:

```cs
[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:

```cs
<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
```

### Notes:

```cs
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();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://pinvokeisalive.gitbook.io/pinvoke/directory/structures/strret.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
