大网数据广告活动
网络与域名解析

UtilAssembleStringsWithAlloc function (Ndattributils.h)

· 52CE 我爱测

Allocates a string and formats it using strings provided by the string table. This function uses StringCchPrintf to create the formatted string.

The UtilAssembleStringsWithAlloc function allocates a string and formats it using strings provided by the string table. This function uses StringCchPrintf to create the formatted string.

Syntax

HRESULT UtilAssembleStringsWithAlloc(
  _Out_ LPWSTR  *Buffer,
  _In_  UINT    BufferMax,
  _In_  LPCWSTR InputFormat,
  _In_  LPCWSTR InputString,
  _In_  BOOLEAN AdditionalArgument,
  _In_  ULONG   AdditionalValue
);

Parameters

Buffer [out]

Type: LPWSTR*

The location where the newly allocated string will be placed. When the string is no longer needed, it must be released with CoTaskMemFree.

BufferMax [in]

Type: UINT

The maximum number of characters allowed in the string allocated by Buffer. If the resulting formatted string is longer than the number of characters specified, it is truncated and null-terminated.

Note:
This parameter may not be set to zero.

InputFormat [in]

Type: LPCWSTR

String resource out of the string table representing a format parameter passed to StringCchPrintf. It is constructed using MAKEINTRESOURCE.

The resource string format must specify either a format parameter taking a wide string, or a format parameter taking an unsigned long and a wide string.

InputString [in]

Type: LPCWSTR

String resource out of the string table representing an argument passed to StringCchPrintf in place of the wide string in the format parameter. It is constructed using MAKEINTRESOURCE.

AdditionalArgument [in]

Type: BOOLEAN

True if AdditionalValue should be passed in as the first formatting argument to StringCchPrintf; otherwise, false (and only the resource string identified by InputString will be passed).

AdditionalValue [in]

Type: ULONG

The value to pass as the first formatting argument to StringCchPrintf if AdditionalArgument is true.

Return value

Type: HRESULT

Possible return values include, but are not limited to, the following.

Return code Description
S_OK The operation succeeded.
E_INVALIDARG One or more parameters has not been provided correctly.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Header Ndattributils.h

See also

UtilStringCopyWithAlloc

UtilLoadStringWithAlloc

StringCchPrintf

MAKEINTRESOURCE

CoTaskMemFree

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。