loadstring (user32)
Last changed: -12.129.7.100

.
Summary

C# Signature:

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int LoadString(IntPtr hInstance, uint uID,StringBuilder lpBuffer, int nBufferMax);

VB.Net Signature:

<DllImport("User32", SetLastError:=True)> _
Public Shared Function LoadString(ByVal hInstance As IntPtr, ByVal uID As UInt32, ByVal lpBuffer As Text.StringBuilder, ByVal nBufferMax As Integer) As Integer
End Function

User-Defined Types:

None.

Notes:

IMPORTANT
Add CharSet = CharSet.Auto otherwise it will replace all non-latin characters with ????

http://msdn.microsoft.com/en-us/library/7b93s42f.aspx

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpcondefaultmarshalingforstrings.htm

suggests that a StringBuilder be used instead of a string type as was listed previously.

Tips & Tricks:

Please add some!

Sample Code:

using System.Text;
public String GetStringResource(IntPtr hModuleInstance, uint uiStringID)
{
    StringBuilder sb = new StringBuilder(255);
    LoadString(hModuleInstance, uiStringID, sb, sb.Capacity + 1);
    return sb.ToString();
}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
LoadString on MSDN