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

PdhBrowseCountersA

関数
カウンター選択ダイアログを表示する(ANSI版)。
DLLpdh.dll文字セットANSI (-A)呼出規約winapi対応OSWindows XP 以降

シグネチャ

// pdh.dll  (ANSI / -A)
#include <windows.h>

DWORD PdhBrowseCountersA(
    PDH_BROWSE_DLG_CONFIG_A* pBrowseDlgData
);

パラメーター

名前方向
pBrowseDlgDataPDH_BROWSE_DLG_CONFIG_A*in

戻り値の型: DWORD

各言語での呼び出し定義

// pdh.dll  (ANSI / -A)
#include <windows.h>

DWORD PdhBrowseCountersA(
    PDH_BROWSE_DLG_CONFIG_A* pBrowseDlgData
);
[DllImport("pdh.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint PdhBrowseCountersA(
    IntPtr pBrowseDlgData   // PDH_BROWSE_DLG_CONFIG_A*
);
<DllImport("pdh.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function PdhBrowseCountersA(
    pBrowseDlgData As IntPtr   ' PDH_BROWSE_DLG_CONFIG_A*
) As UInteger
End Function
' pBrowseDlgData : PDH_BROWSE_DLG_CONFIG_A*
Declare PtrSafe Function PdhBrowseCountersA Lib "pdh" ( _
    ByVal pBrowseDlgData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	pdh = windows.NewLazySystemDLL("pdh.dll")
	procPdhBrowseCountersA = pdh.NewProc("PdhBrowseCountersA")
)

// pBrowseDlgData (PDH_BROWSE_DLG_CONFIG_A*)
r1, _, err := procPdhBrowseCountersA.Call(
	uintptr(pBrowseDlgData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function PdhBrowseCountersA(
  pBrowseDlgData: Pointer   // PDH_BROWSE_DLG_CONFIG_A*
): DWORD; stdcall;
  external 'pdh.dll' name 'PdhBrowseCountersA';
result := DllCall("pdh\PdhBrowseCountersA"
    , "Ptr", pBrowseDlgData   ; PDH_BROWSE_DLG_CONFIG_A*
    , "UInt")   ; return: DWORD
●PdhBrowseCountersA(pBrowseDlgData) = DLL("pdh.dll", "dword PdhBrowseCountersA(void*)")
# 呼び出し: PdhBrowseCountersA(pBrowseDlgData)
# pBrowseDlgData : PDH_BROWSE_DLG_CONFIG_A* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。