Win32 API 日本語リファレンス
ホームUI.Shell › SHGlobalCounterGetValue

SHGlobalCounterGetValue

関数
指定したグローバルカウンターの現在値を取得する。
DLLSHLWAPI.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

INT SHGlobalCounterGetValue(
    SHGLOBALCOUNTER id
);

パラメーター

名前方向
idSHGLOBALCOUNTERin

戻り値の型: INT

各言語での呼び出し定義

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

INT SHGlobalCounterGetValue(
    SHGLOBALCOUNTER id
);
[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern int SHGlobalCounterGetValue(
    int id   // SHGLOBALCOUNTER
);
<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function SHGlobalCounterGetValue(
    id As Integer   ' SHGLOBALCOUNTER
) As Integer
End Function
' id : SHGLOBALCOUNTER
Declare PtrSafe Function SHGlobalCounterGetValue Lib "shlwapi" ( _
    ByVal id As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SHGlobalCounterGetValue = ctypes.windll.shlwapi.SHGlobalCounterGetValue
SHGlobalCounterGetValue.restype = ctypes.c_int
SHGlobalCounterGetValue.argtypes = [
    ctypes.c_int,  # id : SHGLOBALCOUNTER
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
SHGlobalCounterGetValue = Fiddle::Function.new(
  lib['SHGlobalCounterGetValue'],
  [
    Fiddle::TYPE_INT,  # id : SHGLOBALCOUNTER
  ],
  Fiddle::TYPE_INT)
#[link(name = "shlwapi")]
extern "system" {
    fn SHGlobalCounterGetValue(
        id: i32  // SHGLOBALCOUNTER
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHLWAPI.dll")]
public static extern int SHGlobalCounterGetValue(int id);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_SHGlobalCounterGetValue' -Namespace Win32 -PassThru
# $api::SHGlobalCounterGetValue(id)
#uselib "SHLWAPI.dll"
#func global SHGlobalCounterGetValue "SHGlobalCounterGetValue" sptr
; SHGlobalCounterGetValue id   ; 戻り値は stat
; id : SHGLOBALCOUNTER -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHLWAPI.dll"
#cfunc global SHGlobalCounterGetValue "SHGlobalCounterGetValue" int
; res = SHGlobalCounterGetValue(id)
; id : SHGLOBALCOUNTER -> "int"
; INT SHGlobalCounterGetValue(SHGLOBALCOUNTER id)
#uselib "SHLWAPI.dll"
#cfunc global SHGlobalCounterGetValue "SHGlobalCounterGetValue" int
; res = SHGlobalCounterGetValue(id)
; id : SHGLOBALCOUNTER -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procSHGlobalCounterGetValue = shlwapi.NewProc("SHGlobalCounterGetValue")
)

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