com.d: Fix named arguments count

This commit is contained in:
Dennis Korpel 2024-06-28 12:20:46 +02:00
parent 362e671308
commit 97a7b4c84b
1 changed files with 3 additions and 3 deletions

6
com.d
View File

@ -404,7 +404,7 @@ struct ComProperty {
/// ///
/// So to call: `Com.f(10, 20, A: 30, B: 40)`, invoke this function as follows: /// So to call: `Com.f(10, 20, A: 30, B: 40)`, invoke this function as follows:
/// --- /// ---
/// Com.f().callWithNamedArgs!(["A", "B"])(10, 20, 30, 40); /// Com.f().callWithNamedArgs(["A", "B"], 10, 20, 30, 40);
/// --- /// ---
/// Argument names are case-insensitive /// Argument names are case-insensitive
ComResult callWithNamedArgs(Args...)(string[] argNames, Args args) { ComResult callWithNamedArgs(Args...)(string[] argNames, Args args) {
@ -433,11 +433,11 @@ struct ComProperty {
} }
DISPID[Args.length + 1] dispIds; DISPID[Args.length + 1] dispIds;
innerComObject_.GetIDsOfNames( innerComObject_.GetIDsOfNames(
&GUID_NULL, namesW.ptr, namesW.length, LOCALE_SYSTEM_DEFAULT, dispIds.ptr &GUID_NULL, namesW.ptr, cast(uint) (1 + argNames.length), LOCALE_SYSTEM_DEFAULT, dispIds.ptr
).ComCheck("Unknown parameter name"); ).ComCheck("Unknown parameter name");
// Strip Member name at index 0 // Strip Member name at index 0
disp_params.cNamedArgs = dispIds.length - 1; disp_params.cNamedArgs = cast(uint) argNames.length;
disp_params.rgdispidNamedArgs = &dispIds[1]; disp_params.rgdispidNamedArgs = &dispIds[1];
} }
} }