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

PdhSetLogSetRunID

関数
ログセットの実行IDを設定する。
DLLpdh.dll呼出規約winapi

シグネチャ

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

DWORD PdhSetLogSetRunID(
    PDH_HLOG hLog,
    INT RunId
);

パラメーター

名前方向
hLogPDH_HLOGinout
RunIdINTin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

PdhSetLogSetRunID = ctypes.windll.pdh.PdhSetLogSetRunID
PdhSetLogSetRunID.restype = wintypes.DWORD
PdhSetLogSetRunID.argtypes = [
    wintypes.HANDLE,  # hLog : PDH_HLOG in/out
    ctypes.c_int,  # RunId : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	pdh = windows.NewLazySystemDLL("pdh.dll")
	procPdhSetLogSetRunID = pdh.NewProc("PdhSetLogSetRunID")
)

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