Win32 API 日本語リファレンス
ホームNetworkManagement.P2P › PeerGraphGetNextItem

PeerGraphGetNextItem

関数
ピア列挙ハンドルから次の項目群を取得する。
DLLP2PGRAPH.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// P2PGRAPH.dll
#include <windows.h>

HRESULT PeerGraphGetNextItem(
    void* hPeerEnum,
    DWORD* pCount,
    void*** pppvItems
);

パラメーター

名前方向説明
hPeerEnumvoid*in列挙ハンドル。対象の列挙を指す。
pCountDWORD*inout入力で要求数、出力で実際に取得した数を受け取るポインター。
pppvItemsvoid***out取得したアイテムのポインター配列を受け取る。使用後PeerGraphFreeDataで解放する。

戻り値の型: HRESULT

各言語での呼び出し定義

// P2PGRAPH.dll
#include <windows.h>

HRESULT PeerGraphGetNextItem(
    void* hPeerEnum,
    DWORD* pCount,
    void*** pppvItems
);
[DllImport("P2PGRAPH.dll", ExactSpelling = true)]
static extern int PeerGraphGetNextItem(
    IntPtr hPeerEnum,   // void*
    ref uint pCount,   // DWORD* in/out
    IntPtr pppvItems   // void*** out
);
<DllImport("P2PGRAPH.dll", ExactSpelling:=True)>
Public Shared Function PeerGraphGetNextItem(
    hPeerEnum As IntPtr,   ' void*
    ByRef pCount As UInteger,   ' DWORD* in/out
    pppvItems As IntPtr   ' void*** out
) As Integer
End Function
' hPeerEnum : void*
' pCount : DWORD* in/out
' pppvItems : void*** out
Declare PtrSafe Function PeerGraphGetNextItem Lib "p2pgraph" ( _
    ByVal hPeerEnum As LongPtr, _
    ByRef pCount As Long, _
    ByVal pppvItems As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerGraphGetNextItem = ctypes.windll.p2pgraph.PeerGraphGetNextItem
PeerGraphGetNextItem.restype = ctypes.c_int
PeerGraphGetNextItem.argtypes = [
    ctypes.POINTER(None),  # hPeerEnum : void*
    ctypes.POINTER(wintypes.DWORD),  # pCount : DWORD* in/out
    ctypes.c_void_p,  # pppvItems : void*** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('P2PGRAPH.dll')
PeerGraphGetNextItem = Fiddle::Function.new(
  lib['PeerGraphGetNextItem'],
  [
    Fiddle::TYPE_VOIDP,  # hPeerEnum : void*
    Fiddle::TYPE_VOIDP,  # pCount : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # pppvItems : void*** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "p2pgraph")]
extern "system" {
    fn PeerGraphGetNextItem(
        hPeerEnum: *mut (),  // void*
        pCount: *mut u32,  // DWORD* in/out
        pppvItems: *mut *mut *mut ()  // void*** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("P2PGRAPH.dll")]
public static extern int PeerGraphGetNextItem(IntPtr hPeerEnum, ref uint pCount, IntPtr pppvItems);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2PGRAPH_PeerGraphGetNextItem' -Namespace Win32 -PassThru
# $api::PeerGraphGetNextItem(hPeerEnum, pCount, pppvItems)
#uselib "P2PGRAPH.dll"
#func global PeerGraphGetNextItem "PeerGraphGetNextItem" sptr, sptr, sptr
; PeerGraphGetNextItem hPeerEnum, varptr(pCount), pppvItems   ; 戻り値は stat
; hPeerEnum : void* -> "sptr"
; pCount : DWORD* in/out -> "sptr"
; pppvItems : void*** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphGetNextItem "PeerGraphGetNextItem" sptr, var, sptr
; res = PeerGraphGetNextItem(hPeerEnum, pCount, pppvItems)
; hPeerEnum : void* -> "sptr"
; pCount : DWORD* in/out -> "var"
; pppvItems : void*** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT PeerGraphGetNextItem(void* hPeerEnum, DWORD* pCount, void*** pppvItems)
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphGetNextItem "PeerGraphGetNextItem" intptr, var, intptr
; res = PeerGraphGetNextItem(hPeerEnum, pCount, pppvItems)
; hPeerEnum : void* -> "intptr"
; pCount : DWORD* in/out -> "var"
; pppvItems : void*** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
	procPeerGraphGetNextItem = p2pgraph.NewProc("PeerGraphGetNextItem")
)

// hPeerEnum (void*), pCount (DWORD* in/out), pppvItems (void*** out)
r1, _, err := procPeerGraphGetNextItem.Call(
	uintptr(hPeerEnum),
	uintptr(pCount),
	uintptr(pppvItems),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function PeerGraphGetNextItem(
  hPeerEnum: Pointer;   // void*
  pCount: Pointer;   // DWORD* in/out
  pppvItems: Pointer   // void*** out
): Integer; stdcall;
  external 'P2PGRAPH.dll' name 'PeerGraphGetNextItem';
result := DllCall("P2PGRAPH\PeerGraphGetNextItem"
    , "Ptr", hPeerEnum   ; void*
    , "Ptr", pCount   ; DWORD* in/out
    , "Ptr", pppvItems   ; void*** out
    , "Int")   ; return: HRESULT
●PeerGraphGetNextItem(hPeerEnum, pCount, pppvItems) = DLL("P2PGRAPH.dll", "int PeerGraphGetNextItem(void*, void*, void*)")
# 呼び出し: PeerGraphGetNextItem(hPeerEnum, pCount, pppvItems)
# hPeerEnum : void* -> "void*"
# pCount : DWORD* in/out -> "void*"
# pppvItems : void*** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。