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

PeerGraphExportDatabase

関数
ピアグラフのデータベースをファイルにエクスポートする。
DLLP2PGRAPH.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT PeerGraphExportDatabase(
    void* hGraph,
    LPCWSTR pwzFilePath
);

パラメーター

名前方向
hGraphvoid*in
pwzFilePathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT PeerGraphExportDatabase(
    void* hGraph,
    LPCWSTR pwzFilePath
);
[DllImport("P2PGRAPH.dll", ExactSpelling = true)]
static extern int PeerGraphExportDatabase(
    IntPtr hGraph,   // void*
    [MarshalAs(UnmanagedType.LPWStr)] string pwzFilePath   // LPCWSTR
);
<DllImport("P2PGRAPH.dll", ExactSpelling:=True)>
Public Shared Function PeerGraphExportDatabase(
    hGraph As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPWStr)> pwzFilePath As String   ' LPCWSTR
) As Integer
End Function
' hGraph : void*
' pwzFilePath : LPCWSTR
Declare PtrSafe Function PeerGraphExportDatabase Lib "p2pgraph" ( _
    ByVal hGraph 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

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

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

var (
	p2pgraph = windows.NewLazySystemDLL("P2PGRAPH.dll")
	procPeerGraphExportDatabase = p2pgraph.NewProc("PeerGraphExportDatabase")
)

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