ホーム › Media.Multimedia › joySetCapture
joySetCapture
関数ジョイスティックメッセージを指定ウィンドウに捕捉させる。
シグネチャ
// WINMM.dll
#include <windows.h>
DWORD joySetCapture(
HWND hwnd,
DWORD uJoyID,
DWORD uPeriod,
BOOL fChanged
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| uJoyID | DWORD | in |
| uPeriod | DWORD | in |
| fChanged | BOOL | in |
戻り値の型: DWORD
各言語での呼び出し定義
// WINMM.dll
#include <windows.h>
DWORD joySetCapture(
HWND hwnd,
DWORD uJoyID,
DWORD uPeriod,
BOOL fChanged
);[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint joySetCapture(
IntPtr hwnd, // HWND
uint uJoyID, // DWORD
uint uPeriod, // DWORD
bool fChanged // BOOL
);<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function joySetCapture(
hwnd As IntPtr, ' HWND
uJoyID As UInteger, ' DWORD
uPeriod As UInteger, ' DWORD
fChanged As Boolean ' BOOL
) As UInteger
End Function' hwnd : HWND
' uJoyID : DWORD
' uPeriod : DWORD
' fChanged : BOOL
Declare PtrSafe Function joySetCapture Lib "winmm" ( _
ByVal hwnd As LongPtr, _
ByVal uJoyID As Long, _
ByVal uPeriod As Long, _
ByVal fChanged As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
joySetCapture = ctypes.windll.winmm.joySetCapture
joySetCapture.restype = wintypes.DWORD
joySetCapture.argtypes = [
wintypes.HANDLE, # hwnd : HWND
wintypes.DWORD, # uJoyID : DWORD
wintypes.DWORD, # uPeriod : DWORD
wintypes.BOOL, # fChanged : BOOL
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINMM.dll')
joySetCapture = Fiddle::Function.new(
lib['joySetCapture'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
-Fiddle::TYPE_INT, # uJoyID : DWORD
-Fiddle::TYPE_INT, # uPeriod : DWORD
Fiddle::TYPE_INT, # fChanged : BOOL
],
-Fiddle::TYPE_INT)#[link(name = "winmm")]
extern "system" {
fn joySetCapture(
hwnd: *mut core::ffi::c_void, // HWND
uJoyID: u32, // DWORD
uPeriod: u32, // DWORD
fChanged: i32 // BOOL
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WINMM.dll")]
public static extern uint joySetCapture(IntPtr hwnd, uint uJoyID, uint uPeriod, bool fChanged);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINMM_joySetCapture' -Namespace Win32 -PassThru
# $api::joySetCapture(hwnd, uJoyID, uPeriod, fChanged)#uselib "WINMM.dll"
#func global joySetCapture "joySetCapture" sptr, sptr, sptr, sptr
; joySetCapture hwnd, uJoyID, uPeriod, fChanged ; 戻り値は stat
; hwnd : HWND -> "sptr"
; uJoyID : DWORD -> "sptr"
; uPeriod : DWORD -> "sptr"
; fChanged : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WINMM.dll"
#cfunc global joySetCapture "joySetCapture" sptr, int, int, int
; res = joySetCapture(hwnd, uJoyID, uPeriod, fChanged)
; hwnd : HWND -> "sptr"
; uJoyID : DWORD -> "int"
; uPeriod : DWORD -> "int"
; fChanged : BOOL -> "int"; DWORD joySetCapture(HWND hwnd, DWORD uJoyID, DWORD uPeriod, BOOL fChanged)
#uselib "WINMM.dll"
#cfunc global joySetCapture "joySetCapture" intptr, int, int, int
; res = joySetCapture(hwnd, uJoyID, uPeriod, fChanged)
; hwnd : HWND -> "intptr"
; uJoyID : DWORD -> "int"
; uPeriod : DWORD -> "int"
; fChanged : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winmm = windows.NewLazySystemDLL("WINMM.dll")
procjoySetCapture = winmm.NewProc("joySetCapture")
)
// hwnd (HWND), uJoyID (DWORD), uPeriod (DWORD), fChanged (BOOL)
r1, _, err := procjoySetCapture.Call(
uintptr(hwnd),
uintptr(uJoyID),
uintptr(uPeriod),
uintptr(fChanged),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction joySetCapture(
hwnd: THandle; // HWND
uJoyID: DWORD; // DWORD
uPeriod: DWORD; // DWORD
fChanged: BOOL // BOOL
): DWORD; stdcall;
external 'WINMM.dll' name 'joySetCapture';result := DllCall("WINMM\joySetCapture"
, "Ptr", hwnd ; HWND
, "UInt", uJoyID ; DWORD
, "UInt", uPeriod ; DWORD
, "Int", fChanged ; BOOL
, "UInt") ; return: DWORD●joySetCapture(hwnd, uJoyID, uPeriod, fChanged) = DLL("WINMM.dll", "dword joySetCapture(void*, dword, dword, bool)")
# 呼び出し: joySetCapture(hwnd, uJoyID, uPeriod, fChanged)
# hwnd : HWND -> "void*"
# uJoyID : DWORD -> "dword"
# uPeriod : DWORD -> "dword"
# fChanged : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。