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