JoySetCapture DLLCall?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

JoySetCapture DLLCall?

Post by evilC » 02 Nov 2014, 08:04

Hi, I stumbled across the existence of this Windows API call today. I tried to get it to work, but had no joy.

Not exactly sure what it does - I was hoping it could be used to "mask" input from a joystick to anything but the AHK script.

Here is my code:

Code: Select all

#SingleInstance, force
DetectHiddenWindows, on

JoyID := 0

ThisScriptsHWND := WinExist("Ahk_PID " DllCall("GetCurrentProcessId"))

f11::
	ret := DllCall("joySetCapture", "ptr", ThisScriptsHWND, "uint", JoyID , "uint", 10)
	msgbox % 0 + ret
	Return

f12::
	DllCall("joyReleaseCapture", "UINT", JoyID )
	Return
Any ideas?

User avatar
trismarck
Posts: 506
Joined: 30 Sep 2013, 01:48
Location: Poland

Re: JoySetCapture DLLCall?

Post by trismarck » 02 Nov 2014, 13:59

Code: Select all

#SingleInstance, force
JoyID := 0
fChanged := 0
return

f11::
   ret := DllCall("Winmm\joySetCapture" ; Winmm
						, "ptr", A_ScriptHwnd
						, "uint", JoyID
						, "uint", 10
						, "UInt", fChanged ; this param was missing
						, "UInt") ; returns UInt vs Int
   msgbox % ret " " errorlevel	; 6 0 ; - no joystick driver
   Return

HTH

User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: JoySetCapture DLLCall?

Post by evilC » 02 Nov 2014, 16:08

Thanks for that, I had tried passing extra params, but I guess I had messed something up.

Unfortunately, it doesn't seem to do what i hoped it might, which was to hide the stick's input from other applications.

Cheers anyway

Post Reply

Return to “Ask for Help (v1)”