ホーム › Devices.DeviceAndDriverInstallation › CM_Is_Dock_Station_Present_Ex
CM_Is_Dock_Station_Present_Ex
関数リモートマシンでドッキングステーションの有無を判定する。
シグネチャ
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Is_Dock_Station_Present_Ex(
BOOL* pbPresent,
INT_PTR hMachine // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pbPresent | BOOL* | out | ドッキングステーションが存在するか否かの真偽値を受け取る出力先ポインタ。 |
| hMachine | INT_PTR | inoptional | 対象マシンへの接続ハンドル。ローカルの場合はNULL(0)を指定する。 |
戻り値の型: CONFIGRET
各言語での呼び出し定義
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Is_Dock_Station_Present_Ex(
BOOL* pbPresent,
INT_PTR hMachine // optional
);[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern uint CM_Is_Dock_Station_Present_Ex(
out int pbPresent, // BOOL* out
IntPtr hMachine // INT_PTR optional
);<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Function CM_Is_Dock_Station_Present_Ex(
<Out> ByRef pbPresent As Integer, ' BOOL* out
hMachine As IntPtr ' INT_PTR optional
) As UInteger
End Function' pbPresent : BOOL* out
' hMachine : INT_PTR optional
Declare PtrSafe Function CM_Is_Dock_Station_Present_Ex Lib "cfgmgr32" ( _
ByRef pbPresent As Long, _
ByVal hMachine As LongPtr) 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_Ex = ctypes.windll.cfgmgr32.CM_Is_Dock_Station_Present_Ex
CM_Is_Dock_Station_Present_Ex.restype = wintypes.DWORD
CM_Is_Dock_Station_Present_Ex.argtypes = [
ctypes.c_void_p, # pbPresent : BOOL* out
ctypes.c_ssize_t, # hMachine : INT_PTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CFGMGR32.dll')
CM_Is_Dock_Station_Present_Ex = Fiddle::Function.new(
lib['CM_Is_Dock_Station_Present_Ex'],
[
Fiddle::TYPE_VOIDP, # pbPresent : BOOL* out
Fiddle::TYPE_INTPTR_T, # hMachine : INT_PTR optional
],
-Fiddle::TYPE_INT)#[link(name = "cfgmgr32")]
extern "system" {
fn CM_Is_Dock_Station_Present_Ex(
pbPresent: *mut i32, // BOOL* out
hMachine: isize // INT_PTR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CFGMGR32.dll")]
public static extern uint CM_Is_Dock_Station_Present_Ex(out int pbPresent, IntPtr hMachine);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_CM_Is_Dock_Station_Present_Ex' -Namespace Win32 -PassThru
# $api::CM_Is_Dock_Station_Present_Ex(pbPresent, hMachine)#uselib "CFGMGR32.dll"
#func global CM_Is_Dock_Station_Present_Ex "CM_Is_Dock_Station_Present_Ex" sptr, sptr
; CM_Is_Dock_Station_Present_Ex pbPresent, hMachine ; 戻り値は stat
; pbPresent : BOOL* out -> "sptr"
; hMachine : INT_PTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CFGMGR32.dll"
#cfunc global CM_Is_Dock_Station_Present_Ex "CM_Is_Dock_Station_Present_Ex" int, sptr
; res = CM_Is_Dock_Station_Present_Ex(pbPresent, hMachine)
; pbPresent : BOOL* out -> "int"
; hMachine : INT_PTR optional -> "sptr"; CONFIGRET CM_Is_Dock_Station_Present_Ex(BOOL* pbPresent, INT_PTR hMachine)
#uselib "CFGMGR32.dll"
#cfunc global CM_Is_Dock_Station_Present_Ex "CM_Is_Dock_Station_Present_Ex" int, intptr
; res = CM_Is_Dock_Station_Present_Ex(pbPresent, hMachine)
; pbPresent : BOOL* out -> "int"
; hMachine : INT_PTR optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
procCM_Is_Dock_Station_Present_Ex = cfgmgr32.NewProc("CM_Is_Dock_Station_Present_Ex")
)
// pbPresent (BOOL* out), hMachine (INT_PTR optional)
r1, _, err := procCM_Is_Dock_Station_Present_Ex.Call(
uintptr(pbPresent),
uintptr(hMachine),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CONFIGRETfunction CM_Is_Dock_Station_Present_Ex(
pbPresent: Pointer; // BOOL* out
hMachine: NativeInt // INT_PTR optional
): DWORD; stdcall;
external 'CFGMGR32.dll' name 'CM_Is_Dock_Station_Present_Ex';result := DllCall("CFGMGR32\CM_Is_Dock_Station_Present_Ex"
, "Ptr", pbPresent ; BOOL* out
, "Ptr", hMachine ; INT_PTR optional
, "UInt") ; return: CONFIGRET●CM_Is_Dock_Station_Present_Ex(pbPresent, hMachine) = DLL("CFGMGR32.dll", "dword CM_Is_Dock_Station_Present_Ex(void*, int)")
# 呼び出し: CM_Is_Dock_Station_Present_Ex(pbPresent, hMachine)
# pbPresent : BOOL* out -> "void*"
# hMachine : INT_PTR optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。