ホーム › NetworkManagement.P2P › PeerGraphSetPresence
PeerGraphSetPresence
関数ピアグラフ内の自ノードのプレゼンス状態を設定する。
シグネチャ
// P2PGRAPH.dll
#include <windows.h>
HRESULT PeerGraphSetPresence(
void* hGraph,
BOOL fPresent
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hGraph | void* | in |
| fPresent | BOOL | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// P2PGRAPH.dll
#include <windows.h>
HRESULT PeerGraphSetPresence(
void* hGraph,
BOOL fPresent
);[DllImport("P2PGRAPH.dll", ExactSpelling = true)]
static extern int PeerGraphSetPresence(
IntPtr hGraph, // void*
bool fPresent // BOOL
);<DllImport("P2PGRAPH.dll", ExactSpelling:=True)>
Public Shared Function PeerGraphSetPresence(
hGraph As IntPtr, ' void*
fPresent As Boolean ' BOOL
) As Integer
End Function' hGraph : void*
' fPresent : BOOL
Declare PtrSafe Function PeerGraphSetPresence Lib "p2pgraph" ( _
ByVal hGraph As LongPtr, _
ByVal fPresent As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PeerGraphSetPresence = ctypes.windll.p2pgraph.PeerGraphSetPresence
PeerGraphSetPresence.restype = ctypes.c_int
PeerGraphSetPresence.argtypes = [
ctypes.POINTER(None), # hGraph : void*
wintypes.BOOL, # fPresent : BOOL
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('P2PGRAPH.dll')
PeerGraphSetPresence = Fiddle::Function.new(
lib['PeerGraphSetPresence'],
[
Fiddle::TYPE_VOIDP, # hGraph : void*
Fiddle::TYPE_INT, # fPresent : BOOL
],
Fiddle::TYPE_INT)#[link(name = "p2pgraph")]
extern "system" {
fn PeerGraphSetPresence(
hGraph: *mut (), // void*
fPresent: i32 // BOOL
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("P2PGRAPH.dll")]
public static extern int PeerGraphSetPresence(IntPtr hGraph, bool fPresent);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2PGRAPH_PeerGraphSetPresence' -Namespace Win32 -PassThru
# $api::PeerGraphSetPresence(hGraph, fPresent)#uselib "P2PGRAPH.dll"
#func global PeerGraphSetPresence "PeerGraphSetPresence" sptr, sptr
; PeerGraphSetPresence hGraph, fPresent ; 戻り値は stat
; hGraph : void* -> "sptr"
; fPresent : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphSetPresence "PeerGraphSetPresence" sptr, int
; res = PeerGraphSetPresence(hGraph, fPresent)
; hGraph : void* -> "sptr"
; fPresent : BOOL -> "int"; HRESULT PeerGraphSetPresence(void* hGraph, BOOL fPresent)
#uselib "P2PGRAPH.dll"
#cfunc global PeerGraphSetPresence "PeerGraphSetPresence" intptr, int
; res = PeerGraphSetPresence(hGraph, fPresent)
; hGraph : void* -> "intptr"
; fPresent : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
procPeerGraphSetPresence = p2pgraph.NewProc("PeerGraphSetPresence")
)
// hGraph (void*), fPresent (BOOL)
r1, _, err := procPeerGraphSetPresence.Call(
uintptr(hGraph),
uintptr(fPresent),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PeerGraphSetPresence(
hGraph: Pointer; // void*
fPresent: BOOL // BOOL
): Integer; stdcall;
external 'P2PGRAPH.dll' name 'PeerGraphSetPresence';result := DllCall("P2PGRAPH\PeerGraphSetPresence"
, "Ptr", hGraph ; void*
, "Int", fPresent ; BOOL
, "Int") ; return: HRESULT●PeerGraphSetPresence(hGraph, fPresent) = DLL("P2PGRAPH.dll", "int PeerGraphSetPresence(void*, bool)")
# 呼び出し: PeerGraphSetPresence(hGraph, fPresent)
# hGraph : void* -> "void*"
# fPresent : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。