ホーム › Devices.Tapi › phoneGetIconW
phoneGetIconW
関数電話デバイスのアイコンを取得する関数のUnicode版。
シグネチャ
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT phoneGetIconW(
DWORD dwDeviceID,
LPCWSTR lpszDeviceClass,
HICON* lphIcon
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwDeviceID | DWORD | in |
| lpszDeviceClass | LPCWSTR | in |
| lphIcon | HICON* | inout |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT phoneGetIconW(
DWORD dwDeviceID,
LPCWSTR lpszDeviceClass,
HICON* lphIcon
);[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int phoneGetIconW(
uint dwDeviceID, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string lpszDeviceClass, // LPCWSTR
IntPtr lphIcon // HICON* in/out
);<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function phoneGetIconW(
dwDeviceID As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> lpszDeviceClass As String, ' LPCWSTR
lphIcon As IntPtr ' HICON* in/out
) As Integer
End Function' dwDeviceID : DWORD
' lpszDeviceClass : LPCWSTR
' lphIcon : HICON* in/out
Declare PtrSafe Function phoneGetIconW Lib "tapi32" ( _
ByVal dwDeviceID As Long, _
ByVal lpszDeviceClass As LongPtr, _
ByVal lphIcon As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
phoneGetIconW = ctypes.windll.tapi32.phoneGetIconW
phoneGetIconW.restype = ctypes.c_int
phoneGetIconW.argtypes = [
wintypes.DWORD, # dwDeviceID : DWORD
wintypes.LPCWSTR, # lpszDeviceClass : LPCWSTR
ctypes.c_void_p, # lphIcon : HICON* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
phoneGetIconW = Fiddle::Function.new(
lib['phoneGetIconW'],
[
-Fiddle::TYPE_INT, # dwDeviceID : DWORD
Fiddle::TYPE_VOIDP, # lpszDeviceClass : LPCWSTR
Fiddle::TYPE_VOIDP, # lphIcon : HICON* in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "tapi32")]
extern "system" {
fn phoneGetIconW(
dwDeviceID: u32, // DWORD
lpszDeviceClass: *const u16, // LPCWSTR
lphIcon: *mut *mut core::ffi::c_void // HICON* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode)]
public static extern int phoneGetIconW(uint dwDeviceID, [MarshalAs(UnmanagedType.LPWStr)] string lpszDeviceClass, IntPtr lphIcon);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_phoneGetIconW' -Namespace Win32 -PassThru
# $api::phoneGetIconW(dwDeviceID, lpszDeviceClass, lphIcon)#uselib "TAPI32.dll"
#func global phoneGetIconW "phoneGetIconW" wptr, wptr, wptr
; phoneGetIconW dwDeviceID, lpszDeviceClass, lphIcon ; 戻り値は stat
; dwDeviceID : DWORD -> "wptr"
; lpszDeviceClass : LPCWSTR -> "wptr"
; lphIcon : HICON* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "TAPI32.dll"
#cfunc global phoneGetIconW "phoneGetIconW" int, wstr, sptr
; res = phoneGetIconW(dwDeviceID, lpszDeviceClass, lphIcon)
; dwDeviceID : DWORD -> "int"
; lpszDeviceClass : LPCWSTR -> "wstr"
; lphIcon : HICON* in/out -> "sptr"; INT phoneGetIconW(DWORD dwDeviceID, LPCWSTR lpszDeviceClass, HICON* lphIcon)
#uselib "TAPI32.dll"
#cfunc global phoneGetIconW "phoneGetIconW" int, wstr, intptr
; res = phoneGetIconW(dwDeviceID, lpszDeviceClass, lphIcon)
; dwDeviceID : DWORD -> "int"
; lpszDeviceClass : LPCWSTR -> "wstr"
; lphIcon : HICON* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
procphoneGetIconW = tapi32.NewProc("phoneGetIconW")
)
// dwDeviceID (DWORD), lpszDeviceClass (LPCWSTR), lphIcon (HICON* in/out)
r1, _, err := procphoneGetIconW.Call(
uintptr(dwDeviceID),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszDeviceClass))),
uintptr(lphIcon),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction phoneGetIconW(
dwDeviceID: DWORD; // DWORD
lpszDeviceClass: PWideChar; // LPCWSTR
lphIcon: Pointer // HICON* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'phoneGetIconW';result := DllCall("TAPI32\phoneGetIconW"
, "UInt", dwDeviceID ; DWORD
, "WStr", lpszDeviceClass ; LPCWSTR
, "Ptr", lphIcon ; HICON* in/out
, "Int") ; return: INT●phoneGetIconW(dwDeviceID, lpszDeviceClass, lphIcon) = DLL("TAPI32.dll", "int phoneGetIconW(dword, char*, void*)")
# 呼び出し: phoneGetIconW(dwDeviceID, lpszDeviceClass, lphIcon)
# dwDeviceID : DWORD -> "dword"
# lpszDeviceClass : LPCWSTR -> "char*"
# lphIcon : HICON* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。