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

PeerCollabStartup

関数
ピアコラボレーション機能を初期化する。
DLLP2P.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT PeerCollabStartup(
    WORD wVersionRequested
);

パラメーター

名前方向
wVersionRequestedWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT PeerCollabStartup(
    WORD wVersionRequested
);
[DllImport("P2P.dll", ExactSpelling = true)]
static extern int PeerCollabStartup(
    ushort wVersionRequested   // WORD
);
<DllImport("P2P.dll", ExactSpelling:=True)>
Public Shared Function PeerCollabStartup(
    wVersionRequested As UShort   ' WORD
) As Integer
End Function
' wVersionRequested : WORD
Declare PtrSafe Function PeerCollabStartup Lib "p2p" ( _
    ByVal wVersionRequested As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerCollabStartup = ctypes.windll.p2p.PeerCollabStartup
PeerCollabStartup.restype = ctypes.c_int
PeerCollabStartup.argtypes = [
    ctypes.c_ushort,  # wVersionRequested : WORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('P2P.dll')
PeerCollabStartup = Fiddle::Function.new(
  lib['PeerCollabStartup'],
  [
    -Fiddle::TYPE_SHORT,  # wVersionRequested : WORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "p2p")]
extern "system" {
    fn PeerCollabStartup(
        wVersionRequested: u16  // WORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("P2P.dll")]
public static extern int PeerCollabStartup(ushort wVersionRequested);
"@
$api = Add-Type -MemberDefinition $sig -Name 'P2P_PeerCollabStartup' -Namespace Win32 -PassThru
# $api::PeerCollabStartup(wVersionRequested)
#uselib "P2P.dll"
#func global PeerCollabStartup "PeerCollabStartup" sptr
; PeerCollabStartup wVersionRequested   ; 戻り値は stat
; wVersionRequested : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "P2P.dll"
#cfunc global PeerCollabStartup "PeerCollabStartup" int
; res = PeerCollabStartup(wVersionRequested)
; wVersionRequested : WORD -> "int"
; HRESULT PeerCollabStartup(WORD wVersionRequested)
#uselib "P2P.dll"
#cfunc global PeerCollabStartup "PeerCollabStartup" int
; res = PeerCollabStartup(wVersionRequested)
; wVersionRequested : WORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	p2p = windows.NewLazySystemDLL("P2P.dll")
	procPeerCollabStartup = p2p.NewProc("PeerCollabStartup")
)

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