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

PeerCollabGetPresenceInfo

関数
エンドポイントのプレゼンス情報を取得する。
DLLP2P.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT PeerCollabGetPresenceInfo(
    PEER_ENDPOINT* pcEndpoint,   // optional
    PEER_PRESENCE_INFO** ppPresenceInfo
);

パラメーター

名前方向
pcEndpointPEER_ENDPOINT*inoptional
ppPresenceInfoPEER_PRESENCE_INFO**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT PeerCollabGetPresenceInfo(
    PEER_ENDPOINT* pcEndpoint,   // optional
    PEER_PRESENCE_INFO** ppPresenceInfo
);
[DllImport("P2P.dll", ExactSpelling = true)]
static extern int PeerCollabGetPresenceInfo(
    IntPtr pcEndpoint,   // PEER_ENDPOINT* optional
    IntPtr ppPresenceInfo   // PEER_PRESENCE_INFO** out
);
<DllImport("P2P.dll", ExactSpelling:=True)>
Public Shared Function PeerCollabGetPresenceInfo(
    pcEndpoint As IntPtr,   ' PEER_ENDPOINT* optional
    ppPresenceInfo As IntPtr   ' PEER_PRESENCE_INFO** out
) As Integer
End Function
' pcEndpoint : PEER_ENDPOINT* optional
' ppPresenceInfo : PEER_PRESENCE_INFO** out
Declare PtrSafe Function PeerCollabGetPresenceInfo Lib "p2p" ( _
    ByVal pcEndpoint As LongPtr, _
    ByVal ppPresenceInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerCollabGetPresenceInfo = ctypes.windll.p2p.PeerCollabGetPresenceInfo
PeerCollabGetPresenceInfo.restype = ctypes.c_int
PeerCollabGetPresenceInfo.argtypes = [
    ctypes.c_void_p,  # pcEndpoint : PEER_ENDPOINT* optional
    ctypes.c_void_p,  # ppPresenceInfo : PEER_PRESENCE_INFO** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	p2p = windows.NewLazySystemDLL("P2P.dll")
	procPeerCollabGetPresenceInfo = p2p.NewProc("PeerCollabGetPresenceInfo")
)

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