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

joySetThreshold

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

シグネチャ

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

DWORD joySetThreshold(
    DWORD uJoyID,
    DWORD uThreshold
);

パラメーター

名前方向
uJoyIDDWORDin
uThresholdDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

joySetThreshold = ctypes.windll.winmm.joySetThreshold
joySetThreshold.restype = wintypes.DWORD
joySetThreshold.argtypes = [
    wintypes.DWORD,  # uJoyID : DWORD
    wintypes.DWORD,  # uThreshold : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procjoySetThreshold = winmm.NewProc("joySetThreshold")
)

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