Win32 API 日本語リファレンス
ホームMedia.Multimedia › joyGetThreshold

joyGetThreshold

関数
ジョイスティックの移動しきい値を取得する。
DLLWINMM.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD joyGetThreshold(
    DWORD uJoyID,
    DWORD* puThreshold
);

パラメーター

名前方向
uJoyIDDWORDin
puThresholdDWORD*out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD joyGetThreshold(
    DWORD uJoyID,
    DWORD* puThreshold
);
[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint joyGetThreshold(
    uint uJoyID,   // DWORD
    out uint puThreshold   // DWORD* out
);
<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function joyGetThreshold(
    uJoyID As UInteger,   ' DWORD
    <Out> ByRef puThreshold As UInteger   ' DWORD* out
) As UInteger
End Function
' uJoyID : DWORD
' puThreshold : DWORD* out
Declare PtrSafe Function joyGetThreshold Lib "winmm" ( _
    ByVal uJoyID As Long, _
    ByRef puThreshold As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

joyGetThreshold = ctypes.windll.winmm.joyGetThreshold
joyGetThreshold.restype = wintypes.DWORD
joyGetThreshold.argtypes = [
    wintypes.DWORD,  # uJoyID : DWORD
    ctypes.POINTER(wintypes.DWORD),  # puThreshold : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WINMM.dll')
joyGetThreshold = Fiddle::Function.new(
  lib['joyGetThreshold'],
  [
    -Fiddle::TYPE_INT,  # uJoyID : DWORD
    Fiddle::TYPE_VOIDP,  # puThreshold : DWORD* out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "winmm")]
extern "system" {
    fn joyGetThreshold(
        uJoyID: u32,  // DWORD
        puThreshold: *mut u32  // DWORD* out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WINMM.dll")]
public static extern uint joyGetThreshold(uint uJoyID, out uint puThreshold);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINMM_joyGetThreshold' -Namespace Win32 -PassThru
# $api::joyGetThreshold(uJoyID, puThreshold)
#uselib "WINMM.dll"
#func global joyGetThreshold "joyGetThreshold" sptr, sptr
; joyGetThreshold uJoyID, varptr(puThreshold)   ; 戻り値は stat
; uJoyID : DWORD -> "sptr"
; puThreshold : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WINMM.dll"
#cfunc global joyGetThreshold "joyGetThreshold" int, var
; res = joyGetThreshold(uJoyID, puThreshold)
; uJoyID : DWORD -> "int"
; puThreshold : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD joyGetThreshold(DWORD uJoyID, DWORD* puThreshold)
#uselib "WINMM.dll"
#cfunc global joyGetThreshold "joyGetThreshold" int, var
; res = joyGetThreshold(uJoyID, puThreshold)
; uJoyID : DWORD -> "int"
; puThreshold : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procjoyGetThreshold = winmm.NewProc("joyGetThreshold")
)

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