Win32 API 日本語リファレンス
ホームGaming › ShowPlayerPickerUIForUser

ShowPlayerPickerUIForUser

関数
指定ユーザー向けにプレイヤー選択UIを表示する。
DLLapi-ms-win-gaming-tcui-l1-1-2.dll呼出規約winapi

シグネチャ

// api-ms-win-gaming-tcui-l1-1-2.dll
#include <windows.h>

HRESULT ShowPlayerPickerUIForUser(
    IInspectable* user,
    HSTRING promptDisplayText,
    const HSTRING* xuids,
    UINT_PTR xuidsCount,
    const HSTRING* preSelectedXuids,   // optional
    UINT_PTR preSelectedXuidsCount,
    UINT_PTR minSelectionCount,
    UINT_PTR maxSelectionCount,
    PlayerPickerUICompletionRoutine completionRoutine,
    void* context   // optional
);

パラメーター

名前方向説明
userIInspectable*in操作主体のユーザーを表すIInspectableインターフェイスポインタ。
promptDisplayTextHSTRINGinプレイヤー選択UIに表示するプロンプト文を表すHSTRING。
xuidsHSTRING*in選択候補となるプレイヤーのXUID配列(HSTRING)。
xuidsCountUINT_PTRinxuids配列の要素数。
preSelectedXuidsHSTRING*inoptionalあらかじめ選択済みにするXUID配列。NULL可。
preSelectedXuidsCountUINT_PTRinpreSelectedXuids配列の要素数。
minSelectionCountUINT_PTRin選択を確定するために必要な最小選択数。
maxSelectionCountUINT_PTRin選択可能な最大数。
completionRoutinePlayerPickerUICompletionRoutinein選択完了時に呼ばれるコールバック関数。
contextvoid*inoptionalコールバックへ渡されるユーザー定義コンテキスト。NULL可。

戻り値の型: HRESULT

各言語での呼び出し定義

// api-ms-win-gaming-tcui-l1-1-2.dll
#include <windows.h>

HRESULT ShowPlayerPickerUIForUser(
    IInspectable* user,
    HSTRING promptDisplayText,
    const HSTRING* xuids,
    UINT_PTR xuidsCount,
    const HSTRING* preSelectedXuids,   // optional
    UINT_PTR preSelectedXuidsCount,
    UINT_PTR minSelectionCount,
    UINT_PTR maxSelectionCount,
    PlayerPickerUICompletionRoutine completionRoutine,
    void* context   // optional
);
[DllImport("api-ms-win-gaming-tcui-l1-1-2.dll", ExactSpelling = true)]
static extern int ShowPlayerPickerUIForUser(
    IntPtr user,   // IInspectable*
    IntPtr promptDisplayText,   // HSTRING
    IntPtr xuids,   // HSTRING*
    UIntPtr xuidsCount,   // UINT_PTR
    IntPtr preSelectedXuids,   // HSTRING* optional
    UIntPtr preSelectedXuidsCount,   // UINT_PTR
    UIntPtr minSelectionCount,   // UINT_PTR
    UIntPtr maxSelectionCount,   // UINT_PTR
    IntPtr completionRoutine,   // PlayerPickerUICompletionRoutine
    IntPtr context   // void* optional
);
<DllImport("api-ms-win-gaming-tcui-l1-1-2.dll", ExactSpelling:=True)>
Public Shared Function ShowPlayerPickerUIForUser(
    user As IntPtr,   ' IInspectable*
    promptDisplayText As IntPtr,   ' HSTRING
    xuids As IntPtr,   ' HSTRING*
    xuidsCount As UIntPtr,   ' UINT_PTR
    preSelectedXuids As IntPtr,   ' HSTRING* optional
    preSelectedXuidsCount As UIntPtr,   ' UINT_PTR
    minSelectionCount As UIntPtr,   ' UINT_PTR
    maxSelectionCount As UIntPtr,   ' UINT_PTR
    completionRoutine As IntPtr,   ' PlayerPickerUICompletionRoutine
    context As IntPtr   ' void* optional
) As Integer
End Function
' user : IInspectable*
' promptDisplayText : HSTRING
' xuids : HSTRING*
' xuidsCount : UINT_PTR
' preSelectedXuids : HSTRING* optional
' preSelectedXuidsCount : UINT_PTR
' minSelectionCount : UINT_PTR
' maxSelectionCount : UINT_PTR
' completionRoutine : PlayerPickerUICompletionRoutine
' context : void* optional
Declare PtrSafe Function ShowPlayerPickerUIForUser Lib "api-ms-win-gaming-tcui-l1-1-2" ( _
    ByVal user As LongPtr, _
    ByVal promptDisplayText As LongPtr, _
    ByVal xuids As LongPtr, _
    ByVal xuidsCount As LongPtr, _
    ByVal preSelectedXuids As LongPtr, _
    ByVal preSelectedXuidsCount As LongPtr, _
    ByVal minSelectionCount As LongPtr, _
    ByVal maxSelectionCount As LongPtr, _
    ByVal completionRoutine As LongPtr, _
    ByVal context As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ShowPlayerPickerUIForUser = ctypes.windll.LoadLibrary("api-ms-win-gaming-tcui-l1-1-2.dll").ShowPlayerPickerUIForUser
ShowPlayerPickerUIForUser.restype = ctypes.c_int
ShowPlayerPickerUIForUser.argtypes = [
    ctypes.c_void_p,  # user : IInspectable*
    wintypes.HANDLE,  # promptDisplayText : HSTRING
    ctypes.c_void_p,  # xuids : HSTRING*
    ctypes.c_size_t,  # xuidsCount : UINT_PTR
    ctypes.c_void_p,  # preSelectedXuids : HSTRING* optional
    ctypes.c_size_t,  # preSelectedXuidsCount : UINT_PTR
    ctypes.c_size_t,  # minSelectionCount : UINT_PTR
    ctypes.c_size_t,  # maxSelectionCount : UINT_PTR
    ctypes.c_void_p,  # completionRoutine : PlayerPickerUICompletionRoutine
    ctypes.POINTER(None),  # context : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-gaming-tcui-l1-1-2.dll')
ShowPlayerPickerUIForUser = Fiddle::Function.new(
  lib['ShowPlayerPickerUIForUser'],
  [
    Fiddle::TYPE_VOIDP,  # user : IInspectable*
    Fiddle::TYPE_VOIDP,  # promptDisplayText : HSTRING
    Fiddle::TYPE_VOIDP,  # xuids : HSTRING*
    Fiddle::TYPE_UINTPTR_T,  # xuidsCount : UINT_PTR
    Fiddle::TYPE_VOIDP,  # preSelectedXuids : HSTRING* optional
    Fiddle::TYPE_UINTPTR_T,  # preSelectedXuidsCount : UINT_PTR
    Fiddle::TYPE_UINTPTR_T,  # minSelectionCount : UINT_PTR
    Fiddle::TYPE_UINTPTR_T,  # maxSelectionCount : UINT_PTR
    Fiddle::TYPE_VOIDP,  # completionRoutine : PlayerPickerUICompletionRoutine
    Fiddle::TYPE_VOIDP,  # context : void* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "api-ms-win-gaming-tcui-l1-1-2")]
extern "system" {
    fn ShowPlayerPickerUIForUser(
        user: *mut core::ffi::c_void,  // IInspectable*
        promptDisplayText: *mut core::ffi::c_void,  // HSTRING
        xuids: *mut *mut core::ffi::c_void,  // HSTRING*
        xuidsCount: usize,  // UINT_PTR
        preSelectedXuids: *mut *mut core::ffi::c_void,  // HSTRING* optional
        preSelectedXuidsCount: usize,  // UINT_PTR
        minSelectionCount: usize,  // UINT_PTR
        maxSelectionCount: usize,  // UINT_PTR
        completionRoutine: *const core::ffi::c_void,  // PlayerPickerUICompletionRoutine
        context: *mut ()  // void* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-gaming-tcui-l1-1-2.dll")]
public static extern int ShowPlayerPickerUIForUser(IntPtr user, IntPtr promptDisplayText, IntPtr xuids, UIntPtr xuidsCount, IntPtr preSelectedXuids, UIntPtr preSelectedXuidsCount, UIntPtr minSelectionCount, UIntPtr maxSelectionCount, IntPtr completionRoutine, IntPtr context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-gaming-tcui-l1-1-2_ShowPlayerPickerUIForUser' -Namespace Win32 -PassThru
# $api::ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
#uselib "api-ms-win-gaming-tcui-l1-1-2.dll"
#func global ShowPlayerPickerUIForUser "ShowPlayerPickerUIForUser" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ShowPlayerPickerUIForUser user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context   ; 戻り値は stat
; user : IInspectable* -> "sptr"
; promptDisplayText : HSTRING -> "sptr"
; xuids : HSTRING* -> "sptr"
; xuidsCount : UINT_PTR -> "sptr"
; preSelectedXuids : HSTRING* optional -> "sptr"
; preSelectedXuidsCount : UINT_PTR -> "sptr"
; minSelectionCount : UINT_PTR -> "sptr"
; maxSelectionCount : UINT_PTR -> "sptr"
; completionRoutine : PlayerPickerUICompletionRoutine -> "sptr"
; context : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "api-ms-win-gaming-tcui-l1-1-2.dll"
#cfunc global ShowPlayerPickerUIForUser "ShowPlayerPickerUIForUser" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; res = ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
; user : IInspectable* -> "sptr"
; promptDisplayText : HSTRING -> "sptr"
; xuids : HSTRING* -> "sptr"
; xuidsCount : UINT_PTR -> "sptr"
; preSelectedXuids : HSTRING* optional -> "sptr"
; preSelectedXuidsCount : UINT_PTR -> "sptr"
; minSelectionCount : UINT_PTR -> "sptr"
; maxSelectionCount : UINT_PTR -> "sptr"
; completionRoutine : PlayerPickerUICompletionRoutine -> "sptr"
; context : void* optional -> "sptr"
; HRESULT ShowPlayerPickerUIForUser(IInspectable* user, HSTRING promptDisplayText, HSTRING* xuids, UINT_PTR xuidsCount, HSTRING* preSelectedXuids, UINT_PTR preSelectedXuidsCount, UINT_PTR minSelectionCount, UINT_PTR maxSelectionCount, PlayerPickerUICompletionRoutine completionRoutine, void* context)
#uselib "api-ms-win-gaming-tcui-l1-1-2.dll"
#cfunc global ShowPlayerPickerUIForUser "ShowPlayerPickerUIForUser" intptr, intptr, intptr, intptr, intptr, intptr, intptr, intptr, intptr, intptr
; res = ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
; user : IInspectable* -> "intptr"
; promptDisplayText : HSTRING -> "intptr"
; xuids : HSTRING* -> "intptr"
; xuidsCount : UINT_PTR -> "intptr"
; preSelectedXuids : HSTRING* optional -> "intptr"
; preSelectedXuidsCount : UINT_PTR -> "intptr"
; minSelectionCount : UINT_PTR -> "intptr"
; maxSelectionCount : UINT_PTR -> "intptr"
; completionRoutine : PlayerPickerUICompletionRoutine -> "intptr"
; context : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_gaming_tcui_l1_1_2 = windows.NewLazySystemDLL("api-ms-win-gaming-tcui-l1-1-2.dll")
	procShowPlayerPickerUIForUser = api_ms_win_gaming_tcui_l1_1_2.NewProc("ShowPlayerPickerUIForUser")
)

// user (IInspectable*), promptDisplayText (HSTRING), xuids (HSTRING*), xuidsCount (UINT_PTR), preSelectedXuids (HSTRING* optional), preSelectedXuidsCount (UINT_PTR), minSelectionCount (UINT_PTR), maxSelectionCount (UINT_PTR), completionRoutine (PlayerPickerUICompletionRoutine), context (void* optional)
r1, _, err := procShowPlayerPickerUIForUser.Call(
	uintptr(user),
	uintptr(promptDisplayText),
	uintptr(xuids),
	uintptr(xuidsCount),
	uintptr(preSelectedXuids),
	uintptr(preSelectedXuidsCount),
	uintptr(minSelectionCount),
	uintptr(maxSelectionCount),
	uintptr(completionRoutine),
	uintptr(context),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ShowPlayerPickerUIForUser(
  user: Pointer;   // IInspectable*
  promptDisplayText: THandle;   // HSTRING
  xuids: Pointer;   // HSTRING*
  xuidsCount: NativeUInt;   // UINT_PTR
  preSelectedXuids: Pointer;   // HSTRING* optional
  preSelectedXuidsCount: NativeUInt;   // UINT_PTR
  minSelectionCount: NativeUInt;   // UINT_PTR
  maxSelectionCount: NativeUInt;   // UINT_PTR
  completionRoutine: Pointer;   // PlayerPickerUICompletionRoutine
  context: Pointer   // void* optional
): Integer; stdcall;
  external 'api-ms-win-gaming-tcui-l1-1-2.dll' name 'ShowPlayerPickerUIForUser';
result := DllCall("api-ms-win-gaming-tcui-l1-1-2\ShowPlayerPickerUIForUser"
    , "Ptr", user   ; IInspectable*
    , "Ptr", promptDisplayText   ; HSTRING
    , "Ptr", xuids   ; HSTRING*
    , "UPtr", xuidsCount   ; UINT_PTR
    , "Ptr", preSelectedXuids   ; HSTRING* optional
    , "UPtr", preSelectedXuidsCount   ; UINT_PTR
    , "UPtr", minSelectionCount   ; UINT_PTR
    , "UPtr", maxSelectionCount   ; UINT_PTR
    , "Ptr", completionRoutine   ; PlayerPickerUICompletionRoutine
    , "Ptr", context   ; void* optional
    , "Int")   ; return: HRESULT
●ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context) = DLL("api-ms-win-gaming-tcui-l1-1-2.dll", "int ShowPlayerPickerUIForUser(void*, void*, void*, int, void*, int, int, int, void*, void*)")
# 呼び出し: ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
# user : IInspectable* -> "void*"
# promptDisplayText : HSTRING -> "void*"
# xuids : HSTRING* -> "void*"
# xuidsCount : UINT_PTR -> "int"
# preSelectedXuids : HSTRING* optional -> "void*"
# preSelectedXuidsCount : UINT_PTR -> "int"
# minSelectionCount : UINT_PTR -> "int"
# maxSelectionCount : UINT_PTR -> "int"
# completionRoutine : PlayerPickerUICompletionRoutine -> "void*"
# context : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "api-ms-win-gaming-tcui-l1-1-2" fn ShowPlayerPickerUIForUser(
    user: ?*anyopaque, // IInspectable*
    promptDisplayText: ?*anyopaque, // HSTRING
    xuids: ?*anyopaque, // HSTRING*
    xuidsCount: usize, // UINT_PTR
    preSelectedXuids: ?*anyopaque, // HSTRING* optional
    preSelectedXuidsCount: usize, // UINT_PTR
    minSelectionCount: usize, // UINT_PTR
    maxSelectionCount: usize, // UINT_PTR
    completionRoutine: ?*anyopaque, // PlayerPickerUICompletionRoutine
    context: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) i32;
proc ShowPlayerPickerUIForUser(
    user: pointer,  # IInspectable*
    promptDisplayText: pointer,  # HSTRING
    xuids: pointer,  # HSTRING*
    xuidsCount: uint,  # UINT_PTR
    preSelectedXuids: pointer,  # HSTRING* optional
    preSelectedXuidsCount: uint,  # UINT_PTR
    minSelectionCount: uint,  # UINT_PTR
    maxSelectionCount: uint,  # UINT_PTR
    completionRoutine: pointer,  # PlayerPickerUICompletionRoutine
    context: pointer  # void* optional
): int32 {.importc: "ShowPlayerPickerUIForUser", stdcall, dynlib: "api-ms-win-gaming-tcui-l1-1-2.dll".}
pragma(lib, "api-ms-win-gaming-tcui-l1-1-2");
extern(Windows)
int ShowPlayerPickerUIForUser(
    void* user,   // IInspectable*
    void* promptDisplayText,   // HSTRING
    void* xuids,   // HSTRING*
    size_t xuidsCount,   // UINT_PTR
    void* preSelectedXuids,   // HSTRING* optional
    size_t preSelectedXuidsCount,   // UINT_PTR
    size_t minSelectionCount,   // UINT_PTR
    size_t maxSelectionCount,   // UINT_PTR
    void* completionRoutine,   // PlayerPickerUICompletionRoutine
    void* context   // void* optional
);
ccall((:ShowPlayerPickerUIForUser, "api-ms-win-gaming-tcui-l1-1-2.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Csize_t, Ptr{Cvoid}, Csize_t, Csize_t, Csize_t, Ptr{Cvoid}, Ptr{Cvoid}),
      user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
# user : IInspectable* -> Ptr{Cvoid}
# promptDisplayText : HSTRING -> Ptr{Cvoid}
# xuids : HSTRING* -> Ptr{Cvoid}
# xuidsCount : UINT_PTR -> Csize_t
# preSelectedXuids : HSTRING* optional -> Ptr{Cvoid}
# preSelectedXuidsCount : UINT_PTR -> Csize_t
# minSelectionCount : UINT_PTR -> Csize_t
# maxSelectionCount : UINT_PTR -> Csize_t
# completionRoutine : PlayerPickerUICompletionRoutine -> Ptr{Cvoid}
# context : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t ShowPlayerPickerUIForUser(
    void* user,
    void* promptDisplayText,
    void* xuids,
    uintptr_t xuidsCount,
    void* preSelectedXuids,
    uintptr_t preSelectedXuidsCount,
    uintptr_t minSelectionCount,
    uintptr_t maxSelectionCount,
    void* completionRoutine,
    void* context);
]]
local api-ms-win-gaming-tcui-l1-1-2 = ffi.load("api-ms-win-gaming-tcui-l1-1-2")
-- api-ms-win-gaming-tcui-l1-1-2.ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
-- user : IInspectable*
-- promptDisplayText : HSTRING
-- xuids : HSTRING*
-- xuidsCount : UINT_PTR
-- preSelectedXuids : HSTRING* optional
-- preSelectedXuidsCount : UINT_PTR
-- minSelectionCount : UINT_PTR
-- maxSelectionCount : UINT_PTR
-- completionRoutine : PlayerPickerUICompletionRoutine
-- context : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('api-ms-win-gaming-tcui-l1-1-2.dll');
const ShowPlayerPickerUIForUser = lib.func('__stdcall', 'ShowPlayerPickerUIForUser', 'int32_t', ['void *', 'void *', 'void *', 'uintptr_t', 'void *', 'uintptr_t', 'uintptr_t', 'uintptr_t', 'void *', 'void *']);
// ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
// user : IInspectable* -> 'void *'
// promptDisplayText : HSTRING -> 'void *'
// xuids : HSTRING* -> 'void *'
// xuidsCount : UINT_PTR -> 'uintptr_t'
// preSelectedXuids : HSTRING* optional -> 'void *'
// preSelectedXuidsCount : UINT_PTR -> 'uintptr_t'
// minSelectionCount : UINT_PTR -> 'uintptr_t'
// maxSelectionCount : UINT_PTR -> 'uintptr_t'
// completionRoutine : PlayerPickerUICompletionRoutine -> 'void *'
// context : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。
const lib = Deno.dlopen("api-ms-win-gaming-tcui-l1-1-2.dll", {
  ShowPlayerPickerUIForUser: { parameters: ["pointer", "pointer", "pointer", "usize", "pointer", "usize", "usize", "usize", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context)
// user : IInspectable* -> "pointer"
// promptDisplayText : HSTRING -> "pointer"
// xuids : HSTRING* -> "pointer"
// xuidsCount : UINT_PTR -> "usize"
// preSelectedXuids : HSTRING* optional -> "pointer"
// preSelectedXuidsCount : UINT_PTR -> "usize"
// minSelectionCount : UINT_PTR -> "usize"
// maxSelectionCount : UINT_PTR -> "usize"
// completionRoutine : PlayerPickerUICompletionRoutine -> "pointer"
// context : void* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t ShowPlayerPickerUIForUser(
    void* user,
    void* promptDisplayText,
    void* xuids,
    size_t xuidsCount,
    void* preSelectedXuids,
    size_t preSelectedXuidsCount,
    size_t minSelectionCount,
    size_t maxSelectionCount,
    void* completionRoutine,
    void* context);
C, "api-ms-win-gaming-tcui-l1-1-2.dll");
// $ffi->ShowPlayerPickerUIForUser(user, promptDisplayText, xuids, xuidsCount, preSelectedXuids, preSelectedXuidsCount, minSelectionCount, maxSelectionCount, completionRoutine, context);
// user : IInspectable*
// promptDisplayText : HSTRING
// xuids : HSTRING*
// xuidsCount : UINT_PTR
// preSelectedXuids : HSTRING* optional
// preSelectedXuidsCount : UINT_PTR
// minSelectionCount : UINT_PTR
// maxSelectionCount : UINT_PTR
// completionRoutine : PlayerPickerUICompletionRoutine
// context : void* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Api-ms-win-gaming-tcui-l1-1-2 extends StdCallLibrary {
    Api-ms-win-gaming-tcui-l1-1-2 INSTANCE = Native.load("api-ms-win-gaming-tcui-l1-1-2", Api-ms-win-gaming-tcui-l1-1-2.class);
    int ShowPlayerPickerUIForUser(
        Pointer user,   // IInspectable*
        Pointer promptDisplayText,   // HSTRING
        Pointer xuids,   // HSTRING*
        long xuidsCount,   // UINT_PTR
        Pointer preSelectedXuids,   // HSTRING* optional
        long preSelectedXuidsCount,   // UINT_PTR
        long minSelectionCount,   // UINT_PTR
        long maxSelectionCount,   // UINT_PTR
        Callback completionRoutine,   // PlayerPickerUICompletionRoutine
        Pointer context   // void* optional
    );
}
@[Link("api-ms-win-gaming-tcui-l1-1-2")]
lib Libapi-ms-win-gaming-tcui-l1-1-2
  fun ShowPlayerPickerUIForUser = ShowPlayerPickerUIForUser(
    user : Void*,   # IInspectable*
    promptDisplayText : Void*,   # HSTRING
    xuids : Void*,   # HSTRING*
    xuidsCount : LibC::SizeT,   # UINT_PTR
    preSelectedXuids : Void*,   # HSTRING* optional
    preSelectedXuidsCount : LibC::SizeT,   # UINT_PTR
    minSelectionCount : LibC::SizeT,   # UINT_PTR
    maxSelectionCount : LibC::SizeT,   # UINT_PTR
    completionRoutine : Void*,   # PlayerPickerUICompletionRoutine
    context : Void*   # void* optional
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ShowPlayerPickerUIForUserNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, UintPtr, Pointer<Void>, UintPtr, UintPtr, UintPtr, Pointer<Void>, Pointer<Void>);
typedef ShowPlayerPickerUIForUserDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, int, Pointer<Void>, int, int, int, Pointer<Void>, Pointer<Void>);
final ShowPlayerPickerUIForUser = DynamicLibrary.open('api-ms-win-gaming-tcui-l1-1-2.dll')
    .lookupFunction<ShowPlayerPickerUIForUserNative, ShowPlayerPickerUIForUserDart>('ShowPlayerPickerUIForUser');
// user : IInspectable* -> Pointer<Void>
// promptDisplayText : HSTRING -> Pointer<Void>
// xuids : HSTRING* -> Pointer<Void>
// xuidsCount : UINT_PTR -> UintPtr
// preSelectedXuids : HSTRING* optional -> Pointer<Void>
// preSelectedXuidsCount : UINT_PTR -> UintPtr
// minSelectionCount : UINT_PTR -> UintPtr
// maxSelectionCount : UINT_PTR -> UintPtr
// completionRoutine : PlayerPickerUICompletionRoutine -> Pointer<Void>
// context : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ShowPlayerPickerUIForUser(
  user: Pointer;   // IInspectable*
  promptDisplayText: THandle;   // HSTRING
  xuids: Pointer;   // HSTRING*
  xuidsCount: NativeUInt;   // UINT_PTR
  preSelectedXuids: Pointer;   // HSTRING* optional
  preSelectedXuidsCount: NativeUInt;   // UINT_PTR
  minSelectionCount: NativeUInt;   // UINT_PTR
  maxSelectionCount: NativeUInt;   // UINT_PTR
  completionRoutine: Pointer;   // PlayerPickerUICompletionRoutine
  context: Pointer   // void* optional
): Integer; stdcall;
  external 'api-ms-win-gaming-tcui-l1-1-2.dll' name 'ShowPlayerPickerUIForUser';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ShowPlayerPickerUIForUser"
  c_ShowPlayerPickerUIForUser :: Ptr () -> Ptr () -> Ptr () -> CUIntPtr -> Ptr () -> CUIntPtr -> CUIntPtr -> CUIntPtr -> Ptr () -> Ptr () -> IO Int32
-- user : IInspectable* -> Ptr ()
-- promptDisplayText : HSTRING -> Ptr ()
-- xuids : HSTRING* -> Ptr ()
-- xuidsCount : UINT_PTR -> CUIntPtr
-- preSelectedXuids : HSTRING* optional -> Ptr ()
-- preSelectedXuidsCount : UINT_PTR -> CUIntPtr
-- minSelectionCount : UINT_PTR -> CUIntPtr
-- maxSelectionCount : UINT_PTR -> CUIntPtr
-- completionRoutine : PlayerPickerUICompletionRoutine -> Ptr ()
-- context : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let showplayerpickeruiforuser =
  foreign "ShowPlayerPickerUIForUser"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> size_t @-> (ptr void) @-> size_t @-> size_t @-> size_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* user : IInspectable* -> (ptr void) *)
(* promptDisplayText : HSTRING -> (ptr void) *)
(* xuids : HSTRING* -> (ptr void) *)
(* xuidsCount : UINT_PTR -> size_t *)
(* preSelectedXuids : HSTRING* optional -> (ptr void) *)
(* preSelectedXuidsCount : UINT_PTR -> size_t *)
(* minSelectionCount : UINT_PTR -> size_t *)
(* maxSelectionCount : UINT_PTR -> size_t *)
(* completionRoutine : PlayerPickerUICompletionRoutine -> (ptr void) *)
(* context : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library api-ms-win-gaming-tcui-l1-1-2 (t "api-ms-win-gaming-tcui-l1-1-2.dll"))
(cffi:use-foreign-library api-ms-win-gaming-tcui-l1-1-2)

(cffi:defcfun ("ShowPlayerPickerUIForUser" show-player-picker-uifor-user :convention :stdcall) :int32
  (user :pointer)   ; IInspectable*
  (prompt-display-text :pointer)   ; HSTRING
  (xuids :pointer)   ; HSTRING*
  (xuids-count :uint64)   ; UINT_PTR
  (pre-selected-xuids :pointer)   ; HSTRING* optional
  (pre-selected-xuids-count :uint64)   ; UINT_PTR
  (min-selection-count :uint64)   ; UINT_PTR
  (max-selection-count :uint64)   ; UINT_PTR
  (completion-routine :pointer)   ; PlayerPickerUICompletionRoutine
  (context :pointer))   ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ShowPlayerPickerUIForUser = Win32::API::More->new('api-ms-win-gaming-tcui-l1-1-2',
    'int ShowPlayerPickerUIForUser(LPVOID user, HANDLE promptDisplayText, HANDLE xuids, WPARAM xuidsCount, HANDLE preSelectedXuids, WPARAM preSelectedXuidsCount, WPARAM minSelectionCount, WPARAM maxSelectionCount, LPVOID completionRoutine, LPVOID context)');
# my $ret = $ShowPlayerPickerUIForUser->Call($user, $promptDisplayText, $xuids, $xuidsCount, $preSelectedXuids, $preSelectedXuidsCount, $minSelectionCount, $maxSelectionCount, $completionRoutine, $context);
# user : IInspectable* -> LPVOID
# promptDisplayText : HSTRING -> HANDLE
# xuids : HSTRING* -> HANDLE
# xuidsCount : UINT_PTR -> WPARAM
# preSelectedXuids : HSTRING* optional -> HANDLE
# preSelectedXuidsCount : UINT_PTR -> WPARAM
# minSelectionCount : UINT_PTR -> WPARAM
# maxSelectionCount : UINT_PTR -> WPARAM
# completionRoutine : PlayerPickerUICompletionRoutine -> LPVOID
# context : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。

関連項目

使用する型