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

PeerGroupImportDatabase

関数
ファイルからグループのレコードデータベースを取り込む。
DLLP2P.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT PeerGroupImportDatabase(
    void* hGroup,
    LPCWSTR pwzFilePath
);

パラメーター

名前方向
hGroupvoid*in
pwzFilePathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT PeerGroupImportDatabase(
    void* hGroup,
    LPCWSTR pwzFilePath
);
[DllImport("P2P.dll", ExactSpelling = true)]
static extern int PeerGroupImportDatabase(
    IntPtr hGroup,   // void*
    [MarshalAs(UnmanagedType.LPWStr)] string pwzFilePath   // LPCWSTR
);
<DllImport("P2P.dll", ExactSpelling:=True)>
Public Shared Function PeerGroupImportDatabase(
    hGroup As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPWStr)> pwzFilePath As String   ' LPCWSTR
) As Integer
End Function
' hGroup : void*
' pwzFilePath : LPCWSTR
Declare PtrSafe Function PeerGroupImportDatabase Lib "p2p" ( _
    ByVal hGroup As LongPtr, _
    ByVal pwzFilePath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PeerGroupImportDatabase = ctypes.windll.p2p.PeerGroupImportDatabase
PeerGroupImportDatabase.restype = ctypes.c_int
PeerGroupImportDatabase.argtypes = [
    ctypes.POINTER(None),  # hGroup : void*
    wintypes.LPCWSTR,  # pwzFilePath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	p2p = windows.NewLazySystemDLL("P2P.dll")
	procPeerGroupImportDatabase = p2p.NewProc("PeerGroupImportDatabase")
)

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