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

MultinetGetConnectionPerformanceW

関数
ネットワーク接続の性能情報を取得する(Unicode版)。
DLLMPR.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// MPR.dll  (Unicode / -W)
#include <windows.h>

DWORD MultinetGetConnectionPerformanceW(
    NETRESOURCEW* lpNetResource,
    NETCONNECTINFOSTRUCT* lpNetConnectInfoStruct
);

パラメーター

名前方向
lpNetResourceNETRESOURCEW*in
lpNetConnectInfoStructNETCONNECTINFOSTRUCT*out

戻り値の型: DWORD

各言語での呼び出し定義

// MPR.dll  (Unicode / -W)
#include <windows.h>

DWORD MultinetGetConnectionPerformanceW(
    NETRESOURCEW* lpNetResource,
    NETCONNECTINFOSTRUCT* lpNetConnectInfoStruct
);
[DllImport("MPR.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MultinetGetConnectionPerformanceW(
    IntPtr lpNetResource,   // NETRESOURCEW*
    IntPtr lpNetConnectInfoStruct   // NETCONNECTINFOSTRUCT* out
);
<DllImport("MPR.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MultinetGetConnectionPerformanceW(
    lpNetResource As IntPtr,   ' NETRESOURCEW*
    lpNetConnectInfoStruct As IntPtr   ' NETCONNECTINFOSTRUCT* out
) As UInteger
End Function
' lpNetResource : NETRESOURCEW*
' lpNetConnectInfoStruct : NETCONNECTINFOSTRUCT* out
Declare PtrSafe Function MultinetGetConnectionPerformanceW Lib "mpr" ( _
    ByVal lpNetResource As LongPtr, _
    ByVal lpNetConnectInfoStruct As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MultinetGetConnectionPerformanceW = ctypes.windll.mpr.MultinetGetConnectionPerformanceW
MultinetGetConnectionPerformanceW.restype = wintypes.DWORD
MultinetGetConnectionPerformanceW.argtypes = [
    ctypes.c_void_p,  # lpNetResource : NETRESOURCEW*
    ctypes.c_void_p,  # lpNetConnectInfoStruct : NETCONNECTINFOSTRUCT* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MPR.dll')
MultinetGetConnectionPerformanceW = Fiddle::Function.new(
  lib['MultinetGetConnectionPerformanceW'],
  [
    Fiddle::TYPE_VOIDP,  # lpNetResource : NETRESOURCEW*
    Fiddle::TYPE_VOIDP,  # lpNetConnectInfoStruct : NETCONNECTINFOSTRUCT* out
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "mpr")]
extern "system" {
    fn MultinetGetConnectionPerformanceW(
        lpNetResource: *mut NETRESOURCEW,  // NETRESOURCEW*
        lpNetConnectInfoStruct: *mut NETCONNECTINFOSTRUCT  // NETCONNECTINFOSTRUCT* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MPR.dll", CharSet = CharSet.Unicode)]
public static extern uint MultinetGetConnectionPerformanceW(IntPtr lpNetResource, IntPtr lpNetConnectInfoStruct);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPR_MultinetGetConnectionPerformanceW' -Namespace Win32 -PassThru
# $api::MultinetGetConnectionPerformanceW(lpNetResource, lpNetConnectInfoStruct)
#uselib "MPR.dll"
#func global MultinetGetConnectionPerformanceW "MultinetGetConnectionPerformanceW" wptr, wptr
; MultinetGetConnectionPerformanceW varptr(lpNetResource), varptr(lpNetConnectInfoStruct)   ; 戻り値は stat
; lpNetResource : NETRESOURCEW* -> "wptr"
; lpNetConnectInfoStruct : NETCONNECTINFOSTRUCT* out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MPR.dll"
#cfunc global MultinetGetConnectionPerformanceW "MultinetGetConnectionPerformanceW" var, var
; res = MultinetGetConnectionPerformanceW(lpNetResource, lpNetConnectInfoStruct)
; lpNetResource : NETRESOURCEW* -> "var"
; lpNetConnectInfoStruct : NETCONNECTINFOSTRUCT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MultinetGetConnectionPerformanceW(NETRESOURCEW* lpNetResource, NETCONNECTINFOSTRUCT* lpNetConnectInfoStruct)
#uselib "MPR.dll"
#cfunc global MultinetGetConnectionPerformanceW "MultinetGetConnectionPerformanceW" var, var
; res = MultinetGetConnectionPerformanceW(lpNetResource, lpNetConnectInfoStruct)
; lpNetResource : NETRESOURCEW* -> "var"
; lpNetConnectInfoStruct : NETCONNECTINFOSTRUCT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mpr = windows.NewLazySystemDLL("MPR.dll")
	procMultinetGetConnectionPerformanceW = mpr.NewProc("MultinetGetConnectionPerformanceW")
)

// lpNetResource (NETRESOURCEW*), lpNetConnectInfoStruct (NETCONNECTINFOSTRUCT* out)
r1, _, err := procMultinetGetConnectionPerformanceW.Call(
	uintptr(lpNetResource),
	uintptr(lpNetConnectInfoStruct),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MultinetGetConnectionPerformanceW(
  lpNetResource: Pointer;   // NETRESOURCEW*
  lpNetConnectInfoStruct: Pointer   // NETCONNECTINFOSTRUCT* out
): DWORD; stdcall;
  external 'MPR.dll' name 'MultinetGetConnectionPerformanceW';
result := DllCall("MPR\MultinetGetConnectionPerformanceW"
    , "Ptr", lpNetResource   ; NETRESOURCEW*
    , "Ptr", lpNetConnectInfoStruct   ; NETCONNECTINFOSTRUCT* out
    , "UInt")   ; return: DWORD
●MultinetGetConnectionPerformanceW(lpNetResource, lpNetConnectInfoStruct) = DLL("MPR.dll", "dword MultinetGetConnectionPerformanceW(void*, void*)")
# 呼び出し: MultinetGetConnectionPerformanceW(lpNetResource, lpNetConnectInfoStruct)
# lpNetResource : NETRESOURCEW* -> "void*"
# lpNetConnectInfoStruct : NETCONNECTINFOSTRUCT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。