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

PdhRemoveCounter

関数
照会からカウンターを削除する。
DLLpdh.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

DWORD PdhRemoveCounter(
    PDH_HCOUNTER hCounter
);

パラメーター

名前方向
hCounterPDH_HCOUNTERin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

PdhRemoveCounter = ctypes.windll.pdh.PdhRemoveCounter
PdhRemoveCounter.restype = wintypes.DWORD
PdhRemoveCounter.argtypes = [
    wintypes.HANDLE,  # hCounter : PDH_HCOUNTER
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('pdh.dll')
PdhRemoveCounter = Fiddle::Function.new(
  lib['PdhRemoveCounter'],
  [
    Fiddle::TYPE_VOIDP,  # hCounter : PDH_HCOUNTER
  ],
  -Fiddle::TYPE_INT)
#[link(name = "pdh")]
extern "system" {
    fn PdhRemoveCounter(
        hCounter: *mut core::ffi::c_void  // PDH_HCOUNTER
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("pdh.dll")]
public static extern uint PdhRemoveCounter(IntPtr hCounter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'pdh_PdhRemoveCounter' -Namespace Win32 -PassThru
# $api::PdhRemoveCounter(hCounter)
#uselib "pdh.dll"
#func global PdhRemoveCounter "PdhRemoveCounter" sptr
; PdhRemoveCounter hCounter   ; 戻り値は stat
; hCounter : PDH_HCOUNTER -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "pdh.dll"
#cfunc global PdhRemoveCounter "PdhRemoveCounter" sptr
; res = PdhRemoveCounter(hCounter)
; hCounter : PDH_HCOUNTER -> "sptr"
; DWORD PdhRemoveCounter(PDH_HCOUNTER hCounter)
#uselib "pdh.dll"
#cfunc global PdhRemoveCounter "PdhRemoveCounter" intptr
; res = PdhRemoveCounter(hCounter)
; hCounter : PDH_HCOUNTER -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	pdh = windows.NewLazySystemDLL("pdh.dll")
	procPdhRemoveCounter = pdh.NewProc("PdhRemoveCounter")
)

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