User32LoadString Method
Loads a string resource from the executable file associated with a specified module,
copies the string into a buffer, and appends a terminating null character.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static int LoadString(
IntPtr hInstance,
uint resourceId,
StringBuilder buffer,
int bufferMax
)
<DllImportAttribute("User32.dll", CharSet := CharSet.Unicode, SetLastError := true>]
Public Shared Function LoadString (
hInstance As IntPtr,
resourceId As UInteger,
buffer As StringBuilder,
bufferMax As Integer
) As Integer
Dim hInstance As IntPtr
Dim resourceId As UInteger
Dim buffer As StringBuilder
Dim bufferMax As Integer
Dim returnValue As Integer
returnValue = User32.LoadString(hInstance,
resourceId, buffer, bufferMax)
public:
[DllImportAttribute(L"User32.dll", CharSet = CharSet::Unicode, SetLastError = true)]
static int LoadString(
IntPtr hInstance,
unsigned int resourceId,
StringBuilder^ buffer,
int bufferMax
)
[<DllImportAttribute("User32.dll", CharSet = CharSet.Unicode, SetLastError = true)>]
static member LoadString :
hInstance : IntPtr *
resourceId : uint32 *
buffer : StringBuilder *
bufferMax : int -> int
No code example is currently available or this language may not be supported.
- hInstance IntPtr
-
A handle to an instance of the module whose executable file contains the string resource.
To get the handle to the application itself, call the GetModuleHandle(String) function with .
- resourceId UInt32
-
The identifier of the string to be loaded.
- buffer StringBuilder
-
The buffer is to receive the string.
Must be of sufficient length to hold a pointer (8 bytes).
- bufferMax Int32
-
The size of the buffer, in characters.
The string is truncated and null-terminated if it is longer than the number of characters specified.
If this parameter is 0, then lpBuffer receives a read-only pointer to the resource itself.
Int32
If the function succeeds, the return value is the number of characters copied into the buffer,
not including the terminating null character, or zero if the string resource does not exist.
To get extended error information, call
GetLastWin32Error.