Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › CM_Is_Dock_Station_Present

CM_Is_Dock_Station_Present

関数
ドッキングステーションが存在するか判定する。
DLLCFGMGR32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

CONFIGRET CM_Is_Dock_Station_Present(
    BOOL* pbPresent
);

パラメーター

名前方向
pbPresentBOOL*out

戻り値の型: CONFIGRET

各言語での呼び出し定義

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

CONFIGRET CM_Is_Dock_Station_Present(
    BOOL* pbPresent
);
[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern uint CM_Is_Dock_Station_Present(
    out int pbPresent   // BOOL* out
);
<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Function CM_Is_Dock_Station_Present(
    <Out> ByRef pbPresent As Integer   ' BOOL* out
) As UInteger
End Function
' pbPresent : BOOL* out
Declare PtrSafe Function CM_Is_Dock_Station_Present Lib "cfgmgr32" ( _
    ByRef pbPresent As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CM_Is_Dock_Station_Present = ctypes.windll.cfgmgr32.CM_Is_Dock_Station_Present
CM_Is_Dock_Station_Present.restype = wintypes.DWORD
CM_Is_Dock_Station_Present.argtypes = [
    ctypes.c_void_p,  # pbPresent : BOOL* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
	procCM_Is_Dock_Station_Present = cfgmgr32.NewProc("CM_Is_Dock_Station_Present")
)

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