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

PeerGraphGetProperties

関数
ピアグラフのプロパティを取得する。
DLLP2PGRAPH.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT PeerGraphGetProperties(
    void* hGraph,
    PEER_GRAPH_PROPERTIES** ppGraphProperties
);

パラメーター

名前方向
hGraphvoid*in
ppGraphPropertiesPEER_GRAPH_PROPERTIES**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

PeerGraphGetProperties = ctypes.windll.p2pgraph.PeerGraphGetProperties
PeerGraphGetProperties.restype = ctypes.c_int
PeerGraphGetProperties.argtypes = [
    ctypes.POINTER(None),  # hGraph : void*
    ctypes.c_void_p,  # ppGraphProperties : PEER_GRAPH_PROPERTIES** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
	procPeerGraphGetProperties = p2pgraph.NewProc("PeerGraphGetProperties")
)

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