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

PeerGraphSetProperties

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

シグネチャ

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

HRESULT PeerGraphSetProperties(
    void* hGraph,
    PEER_GRAPH_PROPERTIES* pGraphProperties
);

パラメーター

名前方向
hGraphvoid*in
pGraphPropertiesPEER_GRAPH_PROPERTIES*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
	procPeerGraphSetProperties = p2pgraph.NewProc("PeerGraphSetProperties")
)

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