Win32 API 日本語リファレンス
ホームSystem.Performance › PdhBrowseCountersHW

PdhBrowseCountersHW

関数
ハンドル指定でカウンター選択ダイアログを表示する。
DLLpdh.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

DWORD PdhBrowseCountersHW(
    PDH_BROWSE_DLG_CONFIG_HW* pBrowseDlgData
);

パラメーター

名前方向
pBrowseDlgDataPDH_BROWSE_DLG_CONFIG_HW*in

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD PdhBrowseCountersHW(
    PDH_BROWSE_DLG_CONFIG_HW* pBrowseDlgData
);
[DllImport("pdh.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint PdhBrowseCountersHW(
    IntPtr pBrowseDlgData   // PDH_BROWSE_DLG_CONFIG_HW*
);
<DllImport("pdh.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function PdhBrowseCountersHW(
    pBrowseDlgData As IntPtr   ' PDH_BROWSE_DLG_CONFIG_HW*
) As UInteger
End Function
' pBrowseDlgData : PDH_BROWSE_DLG_CONFIG_HW*
Declare PtrSafe Function PdhBrowseCountersHW Lib "pdh" ( _
    ByVal pBrowseDlgData 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

PdhBrowseCountersHW = ctypes.windll.pdh.PdhBrowseCountersHW
PdhBrowseCountersHW.restype = wintypes.DWORD
PdhBrowseCountersHW.argtypes = [
    ctypes.c_void_p,  # pBrowseDlgData : PDH_BROWSE_DLG_CONFIG_HW*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	pdh = windows.NewLazySystemDLL("pdh.dll")
	procPdhBrowseCountersHW = pdh.NewProc("PdhBrowseCountersHW")
)

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