Tao.Platform.Windows SDK Documentation

Winmm.joySetCapture Method 

The joySetCature function captures a joystick by causing its messages to be sent to the specified window.

[Visual Basic]
Public Shared Function joySetCapture( _
   ByVal hwnd As Integer, _
   ByVal uJoyID As Integer, _
   ByVal uPeriod As Integer, _
   ByVal fChanged As Boolean _
) As Integer
[C#]
public static int joySetCapture(
   int hwnd,
   int uJoyID,
   int uPeriod,
   bool fChanged
);

Parameters

hwnd
Handle to the window to receive the joystick messages.
uJoyID
Identifier of the joystick. Valid values for uJoyID range from zero (JOYSTICKID1) to 15, except for Windows NT 4.0. For Windows NT 4.0, valid values are limited to JOYSTICKID1 and JOYSTICKID2.
uPeriod
Polling frequency, in milliseconds.
fChanged
Change position flag. Specify TRUE for this parameter to send messages only when the position changes by a value greater than the joystick movement threshold. Otherwise, messages are sent at the polling frequency specified in uPeriod.

Return Value

Returns JOYERR_NOERROR if successful or one of the following error values.

MMSYSERR_NODRIVER - The joystick driver is not present. MMSYSERR_INVALPARAM - Windows 95/98/Me: Invalid joystick ID or hwnd is NULL. JOYERR_NOCANDO - Cannot capture joystick input because a required service (such as a Windows timer) is unavailable. JOYERR_UNPLUGGED - The specified joystick is not connected to the system. JOYERR_PARMS - Windows NT/2000/XP: Invalid joystick ID or hwnd is NULL.

Remarks

This function fails if the specified joystick is currently captured. Call the joyReleaseCapture function to release the captured joystick, or destroy the window to release the joystick automatically.

See Also

Winmm Class | Tao.Platform.Windows Namespace