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

phoneSetLamp

関数
電話の指定したランプの点灯モードを設定する。
DLLTAPI32.dll呼出規約winapi

シグネチャ

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

INT phoneSetLamp(
    DWORD hPhone,
    DWORD dwButtonLampID,
    DWORD dwLampMode
);

パラメーター

名前方向
hPhoneDWORDin
dwButtonLampIDDWORDin
dwLampModeDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

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

phoneSetLamp = ctypes.windll.tapi32.phoneSetLamp
phoneSetLamp.restype = ctypes.c_int
phoneSetLamp.argtypes = [
    wintypes.DWORD,  # hPhone : DWORD
    wintypes.DWORD,  # dwButtonLampID : DWORD
    wintypes.DWORD,  # dwLampMode : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	procphoneSetLamp = tapi32.NewProc("phoneSetLamp")
)

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