ホーム › UI.Input.KeyboardAndMouse › GetKeyboardType
GetKeyboardType
関数キーボードの種類やサブタイプ情報を取得する。
シグネチャ
// USER32.dll
#include <windows.h>
INT GetKeyboardType(
INT nTypeFlag
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| nTypeFlag | INT | in |
戻り値の型: INT
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
INT GetKeyboardType(
INT nTypeFlag
);[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern int GetKeyboardType(
int nTypeFlag // INT
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetKeyboardType(
nTypeFlag As Integer ' INT
) As Integer
End Function' nTypeFlag : INT
Declare PtrSafe Function GetKeyboardType Lib "user32" ( _
ByVal nTypeFlag As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetKeyboardType = ctypes.windll.user32.GetKeyboardType
GetKeyboardType.restype = ctypes.c_int
GetKeyboardType.argtypes = [
ctypes.c_int, # nTypeFlag : INT
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
GetKeyboardType = Fiddle::Function.new(
lib['GetKeyboardType'],
[
Fiddle::TYPE_INT, # nTypeFlag : INT
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn GetKeyboardType(
nTypeFlag: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll", SetLastError = true)]
public static extern int GetKeyboardType(int nTypeFlag);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetKeyboardType' -Namespace Win32 -PassThru
# $api::GetKeyboardType(nTypeFlag)#uselib "USER32.dll"
#func global GetKeyboardType "GetKeyboardType" sptr
; GetKeyboardType nTypeFlag ; 戻り値は stat
; nTypeFlag : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global GetKeyboardType "GetKeyboardType" int
; res = GetKeyboardType(nTypeFlag)
; nTypeFlag : INT -> "int"; INT GetKeyboardType(INT nTypeFlag)
#uselib "USER32.dll"
#cfunc global GetKeyboardType "GetKeyboardType" int
; res = GetKeyboardType(nTypeFlag)
; nTypeFlag : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procGetKeyboardType = user32.NewProc("GetKeyboardType")
)
// nTypeFlag (INT)
r1, _, err := procGetKeyboardType.Call(
uintptr(nTypeFlag),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction GetKeyboardType(
nTypeFlag: Integer // INT
): Integer; stdcall;
external 'USER32.dll' name 'GetKeyboardType';result := DllCall("USER32\GetKeyboardType"
, "Int", nTypeFlag ; INT
, "Int") ; return: INT●GetKeyboardType(nTypeFlag) = DLL("USER32.dll", "int GetKeyboardType(int)")
# 呼び出し: GetKeyboardType(nTypeFlag)
# nTypeFlag : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。