ホーム › Devices.DeviceAndDriverInstallation › CM_Set_HW_Prof
CM_Set_HW_Prof
関数現在のハードウェアプロファイルを設定する。
シグネチャ
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Set_HW_Prof(
DWORD ulHardwareProfile,
DWORD ulFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ulHardwareProfile | DWORD | in |
| ulFlags | DWORD | in |
戻り値の型: CONFIGRET
各言語での呼び出し定義
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Set_HW_Prof(
DWORD ulHardwareProfile,
DWORD ulFlags
);[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern uint CM_Set_HW_Prof(
uint ulHardwareProfile, // DWORD
uint ulFlags // DWORD
);<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Function CM_Set_HW_Prof(
ulHardwareProfile As UInteger, ' DWORD
ulFlags As UInteger ' DWORD
) As UInteger
End Function' ulHardwareProfile : DWORD
' ulFlags : DWORD
Declare PtrSafe Function CM_Set_HW_Prof Lib "cfgmgr32" ( _
ByVal ulHardwareProfile As Long, _
ByVal ulFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CM_Set_HW_Prof = ctypes.windll.cfgmgr32.CM_Set_HW_Prof
CM_Set_HW_Prof.restype = wintypes.DWORD
CM_Set_HW_Prof.argtypes = [
wintypes.DWORD, # ulHardwareProfile : DWORD
wintypes.DWORD, # ulFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CFGMGR32.dll')
CM_Set_HW_Prof = Fiddle::Function.new(
lib['CM_Set_HW_Prof'],
[
-Fiddle::TYPE_INT, # ulHardwareProfile : DWORD
-Fiddle::TYPE_INT, # ulFlags : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "cfgmgr32")]
extern "system" {
fn CM_Set_HW_Prof(
ulHardwareProfile: u32, // DWORD
ulFlags: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CFGMGR32.dll")]
public static extern uint CM_Set_HW_Prof(uint ulHardwareProfile, uint ulFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_CM_Set_HW_Prof' -Namespace Win32 -PassThru
# $api::CM_Set_HW_Prof(ulHardwareProfile, ulFlags)#uselib "CFGMGR32.dll"
#func global CM_Set_HW_Prof "CM_Set_HW_Prof" sptr, sptr
; CM_Set_HW_Prof ulHardwareProfile, ulFlags ; 戻り値は stat
; ulHardwareProfile : DWORD -> "sptr"
; ulFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CFGMGR32.dll"
#cfunc global CM_Set_HW_Prof "CM_Set_HW_Prof" int, int
; res = CM_Set_HW_Prof(ulHardwareProfile, ulFlags)
; ulHardwareProfile : DWORD -> "int"
; ulFlags : DWORD -> "int"; CONFIGRET CM_Set_HW_Prof(DWORD ulHardwareProfile, DWORD ulFlags)
#uselib "CFGMGR32.dll"
#cfunc global CM_Set_HW_Prof "CM_Set_HW_Prof" int, int
; res = CM_Set_HW_Prof(ulHardwareProfile, ulFlags)
; ulHardwareProfile : DWORD -> "int"
; ulFlags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
procCM_Set_HW_Prof = cfgmgr32.NewProc("CM_Set_HW_Prof")
)
// ulHardwareProfile (DWORD), ulFlags (DWORD)
r1, _, err := procCM_Set_HW_Prof.Call(
uintptr(ulHardwareProfile),
uintptr(ulFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CONFIGRETfunction CM_Set_HW_Prof(
ulHardwareProfile: DWORD; // DWORD
ulFlags: DWORD // DWORD
): DWORD; stdcall;
external 'CFGMGR32.dll' name 'CM_Set_HW_Prof';result := DllCall("CFGMGR32\CM_Set_HW_Prof"
, "UInt", ulHardwareProfile ; DWORD
, "UInt", ulFlags ; DWORD
, "UInt") ; return: CONFIGRET●CM_Set_HW_Prof(ulHardwareProfile, ulFlags) = DLL("CFGMGR32.dll", "dword CM_Set_HW_Prof(dword, dword)")
# 呼び出し: CM_Set_HW_Prof(ulHardwareProfile, ulFlags)
# ulHardwareProfile : DWORD -> "dword"
# ulFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。