Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/MM/Joystick.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/MM/Joystick.ab	(revision 585)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/MM/Joystick.ab	(revision 585)
@@ -0,0 +1,461 @@
+
+'#require <api_mmsys.sbp>
+
+Namespace ActiveBasic
+Namespace Windows
+Namespace MM
+
+
+Enum JoyCapability
+	HasZ = &H0001
+	HasR = &H0002
+	HasU = &H0004
+	HasV = &H0008
+	HasPointOfView = &H0010
+	PointOfView4Direction = &H0020
+	PointOfViewContinuous = &H0040
+End Enum
+
+Class JoyCaps
+	caps As JOYCAPS
+
+Protected
+	Sub _Initialize ( id As DWord )
+		joyGetDevCaps(id,caps,SizeOf(JOYCAPS))
+	End Sub
+
+Public
+	Function ManufacturerID () As Word
+		Return This.caps.wMid
+	End Function
+	Function ProductID () As Word
+		Return This.caps.wPid
+	End Function
+	Function ProductName () As String
+		Return New System.String(This.caps.szPname As LPTSTR)
+	End Function
+	Function MinimumX () As DWord
+		Return This.caps.wXmin
+	End Function
+	Function MaximumX () As DWord
+		Return This.caps.wXmax
+	End Function
+	Function MinimumY () As DWord
+		Return This.caps.wYmin
+	End Function
+	Function MaximumY () As DWord
+		Return This.caps.wYmax
+	End Function
+	Function MinimumZ () As DWord
+		Return This.caps.wZmin
+	End Function
+	Function MaximumZ () As DWord
+		Return This.caps.wZmax
+	End Function
+	Function NumberOfButtons () As DWord
+		Return This.caps.wNumButtons
+	End Function
+	Function MinimumMessagePeriod () As DWord
+		Return This.caps.wPeriodMin
+	End Function
+	Function MaximumMessagePeriod () As DWord
+		Return This.caps.wPeriodMax
+	End Function
+	Function MinimumR () As DWord
+		Return This.caps.wRmin
+	End Function
+	Function MaximumR () As DWord
+		Return This.caps.wRmax
+	End Function
+	Function MinimumU () As DWord
+		Return This.caps.wUmin
+	End Function
+	Function MaximumU () As DWord
+		Return This.caps.wUmax
+	End Function
+	Function MinimumV () As DWord
+		Return This.caps.wVmin
+	End Function
+	Function MaximumV () As DWord
+		Return This.caps.wVmax
+	End Function
+	Function Capabilities () As JoyCapability
+		Return This.caps.wCaps As JoyCapability
+	End Function
+	Function NumberOfAxesSupported () As DWord
+		Return This.caps.wMaxAxes
+	End Function
+	Function NumberOfAxesUsed () As DWord
+		Return This.caps.wNumAxes
+	End Function
+	Function NumberOfButtonsSupported () As DWord
+		Return This.caps.wMaxButtons
+	End Function
+	Function RegistryKey () As String
+		Return New System.String(This.caps.szRegKey As LPTSTR)
+	End Function
+	Function OEM_VxD () As String
+		Return New System.String(This.caps.szOEMVxD As LPTSTR)
+	End Function
+End Class
+
+Class JoyButtons
+	dwButtons As DWord
+
+Protected
+	Sub _Initialize ( dw As DWord )
+		This.dwButtons = dw
+	End Sub
+
+Public
+	Function Button1 () As Boolean
+		Return This.Button( 1 )
+	End Function
+	Function Button2 () As Boolean
+		Return This.Button( 2 )
+	End Function
+	Function Button3 () As Boolean
+		Return This.Button( 3 )
+	End Function
+	Function Button4 () As Boolean
+		Return This.Button( 4 )
+	End Function
+	Function Button5 () As Boolean
+		Return This.Button( 5 )
+	End Function
+	Function Button6 () As Boolean
+		Return This.Button( 6 )
+	End Function
+	Function Button7 () As Boolean
+		Return This.Button( 7 )
+	End Function
+	Function Button8 () As Boolean
+		Return This.Button( 8 )
+	End Function
+	Function Button9 () As Boolean
+		Return This.Button( 9 )
+	End Function
+	Function Button10 () As Boolean
+		Return This.Button( 10 )
+	End Function
+	Function Button11 () As Boolean
+		Return This.Button( 11 )
+	End Function
+	Function Button12 () As Boolean
+		Return This.Button( 12 )
+	End Function
+	Function Button13 () As Boolean
+		Return This.Button( 13 )
+	End Function
+	Function Button14 () As Boolean
+		Return This.Button( 14 )
+	End Function
+	Function Button15 () As Boolean
+		Return This.Button( 15 )
+	End Function
+	Function Button16 () As Boolean
+		Return This.Button( 16 )
+	End Function
+	Function Button17 () As Boolean
+		Return This.Button( 17 )
+	End Function
+	Function Button18 () As Boolean
+		Return This.Button( 18 )
+	End Function
+	Function Button19 () As Boolean
+		Return This.Button( 19 )
+	End Function
+	Function Button20 () As Boolean
+		Return This.Button( 20 )
+	End Function
+	Function Button21 () As Boolean
+		Return This.Button( 21 )
+	End Function
+	Function Button22 () As Boolean
+		Return This.Button( 22 )
+	End Function
+	Function Button23 () As Boolean
+		Return This.Button( 23 )
+	End Function
+	Function Button24 () As Boolean
+		Return This.Button( 24 )
+	End Function
+	Function Button25 () As Boolean
+		Return This.Button( 25 )
+	End Function
+	Function Button26 () As Boolean
+		Return This.Button( 26 )
+	End Function
+	Function Button27 () As Boolean
+		Return This.Button( 27 )
+	End Function
+	Function Button28 () As Boolean
+		Return This.Button( 28 )
+	End Function
+	Function Button29 () As Boolean
+		Return This.Button( 29 )
+	End Function
+	Function Button30 () As Boolean
+		Return This.Button( 30 )
+	End Function
+	Function Button31 () As Boolean
+		Return This.Button( 31 )
+	End Function
+	Function Button32 () As Boolean
+		Return This.Button( 32 )
+	End Function
+
+Public
+	Function Button ( n As DWord ) As Boolean
+		Return (1<<(n-1) And This.dwButtons) <> 0
+	End Function
+
+Public
+	Function Operator () As DWord
+		Return This.dwButtons
+	End Function
+
+	Function Operator== (dw As DWord) As Boolean
+		Return This.dwButtons = dw
+	End Function
+	Function Operator And (dw As DWord) As Boolean
+		Return (This.dwButtons And dw) <> 0
+	End Function
+
+End Class
+
+Class JoyPointOfView
+	dwPOV As DWord
+
+Protected
+	Sub _Initialize ( dw As DWord )
+		If LOWORD(dw) = &HFFFF Then dw = -1 
+		This.dwPOV = dw
+	End Sub
+
+Public
+	Static Const Centered = (-1) As DWord
+	Static Const Forward = 0 As DWord
+	Static Const ForwardAndRight = 4500 As DWord
+	Static Const Right = 9000 As DWord
+	Static Const BackwardAndRight = 13500 As DWord
+	Static Const Backward = 18000 As DWord
+	Static Const BackwardAndLeft = 22500 As DWord
+	Static Const Left = 27000 As DWord
+	Static Const ForwardAndLeft = 31500 As DWord
+
+Public
+	Function Operator () As DWord
+		Return This.dwPOV
+	End Function
+
+	Function Operator== (value As DWord) As Boolean
+		Return This.dwPOV = value
+	End Function
+	Function Operator<> ( value As DWord) As Boolean
+		Return This.dwPOV <> value
+	End Function
+	Function Operator<= ( value As DWord) As Boolean
+		Return This.dwPOV <= value
+	End Function
+	Function Operator>= ( value As DWord) As Boolean
+		Return This.dwPOV >= value
+	End Function
+	Function Operator< ( value As DWord) As Boolean
+		Return This.dwPOV < value
+	End Function
+	Function Operator> ( value As DWord) As Boolean
+		Return This.dwPOV > value
+	End Function
+
+	Function Operator== ( value As JoyPointOfView ) As Boolean
+		Return This = value As DWord
+	End Function
+	Function Operator<> ( value As JoyPointOfView ) As Boolean
+		Return This <> value As DWord
+	End Function
+	Function Operator<= ( value As JoyPointOfView ) As Boolean
+		Return This <= value As DWord
+	End Function
+	Function Operator>= ( value As JoyPointOfView ) As Boolean
+		Return This >= value As DWord
+	End Function
+	Function Operator< ( value As JoyPointOfView ) As Boolean
+		Return This < value As DWord
+	End Function
+	Function Operator> ( value As JoyPointOfView ) As Boolean
+		Return This > value As DWord
+	End Function
+End Class
+
+Class JoyInfo
+	info As JOYINFOEX
+
+Protected
+	Sub _Initialize ( id As DWord )
+		This.info.dwSize = SizeOf(JOYINFOEX)
+		This.info.dwFlags = JOY_RETURNALL
+		joyGetPosEx(id,info)
+	End Sub
+
+Public
+	Function X () As DWord
+		Return This.info.dwXpos
+	End Function
+	Function Y () As DWord
+		Return This.info.dwYpos
+	End Function
+	Function Z () As DWord
+		Return This.info.dwZpos
+	End Function
+	Function R () As DWord
+		Return This.info.dwRpos
+	End Function
+	Function U () As DWord
+		Return This.info.dwUpos
+	End Function
+	Function V () As DWord
+		Return This.info.dwVpos
+	End Function
+	Function Buttons () As JoyButtons
+		Return New Detail._System_JoyButtons(This.info.dwButtons)
+	End Function
+	Function ButtonNumber () As DWord
+		Return This.info.dwButtonNumber
+	End Function
+	Function PointOfView () As JoyPointOfView
+		Return New Detail._System_JoyPointOfView(This.info.dwPOV)
+	End Function
+End Class
+
+Class Joystick
+	id As DWord
+
+Protected
+	Sub _Initialize ( id As DWord )
+		This.id = id
+	End Sub
+
+Public
+	Sub Threshold ( value As DWord )
+		joySetThreshold(id,value)
+	End Sub
+	Function Threshold () As DWord
+		joyGetThreshold(id,VarPtr(Threshold))
+	End Function
+
+Public
+	Function GetCapabilities () As JoyCaps
+		Return New Detail._System_JoyCaps(This.id)
+	End Function
+	Function GetInfo() As JoyInfo
+		Return New Detail._System_JoyInfo(This.id)
+	End Function
+
+Public
+	Sub SetCupture ( hwnd As HWND, period As DWord, changed As Boolean)
+		joySetCapture(hwnd,id,period,changed)
+	End Sub
+	Sub ReleaseCapture()
+		joyReleaseCapture(id)
+	End Sub
+End Class
+
+Class Joysticks
+
+Public
+	Static Function NumberOfDevices () As DWord
+		Return joyGetNumDevs()
+	End Function
+	Static Function NumberOfConnectedDevices () As DWord
+		Dim max = Joysticks.NumberOfDevices()
+		Dim cnt=0 As DWord
+		Dim info As JOYINFO
+		While joyGetPos(cnt,info) = JOYERR_NOERROR
+			cnt++
+			If cnt >= max Then Exit While
+		Wend 
+		Return cnt
+	End Function
+
+	Static Function GetJoysticks() As System.Collections.Generic.List<Joystick>
+		Dim list As System.Collections.Generic.List<Joystick>
+		Dim cnt As DWord
+		For cnt=0 To NumberOfConnectedDevices() - 1
+			list.Add(Joysticks.GetJoystick(cnt))
+		Next
+		Return list
+	End Function
+
+	Static Function GetJoystick( id As DWord ) As Joystick
+		Return New Detail._System_Joystick(id)
+	End Function
+
+End Class
+
+Namespace Detail
+Class _System_JoyCaps
+	Inherits JoyCaps
+Public
+	Sub _System_JoyCaps ( id As DWord )
+		This._Initialize(id)
+	End Sub
+
+	Override Function ToString () As String
+		Return "JoyCaps"
+	End Function
+End Class
+
+Class _System_JoyButtons
+	Inherits JoyButtons
+Public
+	Sub _System_JoyButtons ( dw As DWord )
+		This._Initialize(dw)
+	End Sub
+
+	Override Function ToString () As String
+		Return "JoyButtons"
+	End Function
+End Class
+
+Class _System_JoyPointOfView
+	Inherits JoyPointOfView
+Public
+	Sub _System_JoyPointOfView ( dw As DWord )
+		This._Initialize(dw)
+	End Sub
+
+	Override Function ToString () As String
+		Return "JoyPointOfView"
+	End Function
+End Class
+
+Class _System_JoyInfo
+	Inherits JoyInfo
+Public
+	Sub _System_JoyInfo ( id As DWord )
+		This._Initialize(id)
+	End Sub
+
+	Override Function ToString () As String
+		Return "JoyInfo"
+	End Function
+End Class
+
+Class _System_Joystick
+	Inherits Joystick
+Public
+	Sub _System_Joystick ( id As DWord )
+		This._Initialize(id)
+	End Sub
+
+	Override Function ToString () As String
+		Return "Joystick"
+	End Function
+End Class
+
+End Namespace
+
+End Namespace
+End Namespace
+End Namespace
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Registry.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Registry.ab	(revision 584)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Registry.ab	(revision 585)
@@ -45,5 +45,5 @@
 	Function Name( ) As String
 		Dim name As String
-		If IsNothing(This.subkeyname) Then 
+		If ActiveBasic.IsNothing(This.subkeyname) Then 
 			name = This.rootkeyname
 		Else
@@ -76,5 +76,5 @@
 	'新しいサブキーを作成するか、または既存のサブキーを開きます。  
 	Function CreateSubKey( subkey As String ) As RegistryKey
-		If IsNothing(subkey) Then Return Nothing
+		If ActiveBasic.IsNothing(subkey) Then Return Nothing
 		Dim buf = subkey
 		'末尾の\を除去
@@ -108,9 +108,9 @@
 	'指定したサブキーを削除します。文字列 subkey では、大文字と小文字は区別されません。  
 	Sub DeleteSubKey ( subkey As String )
-		If IsNothing( subkey ) Then Exit Sub
+		If ActiveBasic.IsNothing( subkey ) Then Exit Sub
 		This.DeleteSubKey( subkey, True )
 	End Sub
 	Sub DeleteSubKey ( subkey As String, throwOnMissingSubKey As Boolean )
-		If IsNothing( subkey ) Then Exit Sub
+		If ActiveBasic.IsNothing( subkey ) Then Exit Sub
 		Dim key = This.OpenSubKey(subkey)
 		If key.SubKeyCount <> 0 Then
@@ -128,5 +128,5 @@
 	'サブキーとその子サブキーを再帰的に削除します。文字列 subkey では、大文字と小文字は区別されません。  
 	Sub DeleteSubKeyTree ( subkey As String )
-		If IsNothing( subkey ) Then Exit Sub
+		If ActiveBasic.IsNothing( subkey ) Then Exit Sub
 		Dim key = This.OpenSubKey( subkey )
 		If key.SubKeyCount <> 0 Then
@@ -142,9 +142,9 @@
 	'指定した値をこのキーから削除します。  
 	Sub DeleteValue ( name As String )
-		If IsNothing( name ) Then Exit Sub
+		If ActiveBasic.IsNothing( name ) Then Exit Sub
 		This.DeleteValue( name, True )
 	End Sub
 	Sub DeleteValue ( name As String, throwOnMissingValue As Boolean )
-		If IsNothing( name ) Then Exit Sub
+		If ActiveBasic.IsNothing( name ) Then Exit Sub
 		RegDeleteValue( This.handle, ToTCStr(name) )
 		This.edited = True
@@ -203,5 +203,13 @@
 				Return New System.String( pbData As LPCTSTR )
 			Case REG_MULTI_SZ
-				Return New System.String( pbData As LPCTSTR )
+				Dim list As System.Collections.Generic.List<String>
+				Dim s As System.String
+				Do
+					s = New System.String(pbData As *TCHAR)
+					If s.Length = 0 Then Exit Do
+					list.Add(s)
+					pbData += (s.Length + SizeOf(TCHAR))
+				Loop
+				Return list
 			Case REG_QWORD
 				Dim qw As QWord
@@ -221,5 +229,5 @@
 	'指定した名前に関連付けられた値のレジストリ データ型を取得します。  
 	Function GetValueKind ( name As String ) As RegistryValueKind
-		If IsNothing( name ) Then Exit Sub
+		If ActiveBasic.IsNothing( name ) Then Exit Sub
 		Dim dwType As DWord
 		If ERROR_SUCCESS <> RegQueryValueEx( This.handle, ToTCStr(name), 0, VarPtr(dwType), NULL, NULL ) Then
@@ -262,5 +270,5 @@
 	'指定したサブキーを取得します。  
 	Function OpenSubKey ( name As String ) As RegistryKey
-		If IsNothing(name) Then Return Nothing
+		If ActiveBasic.IsNothing(name) Then Return Nothing
 		Dim buf = name
 		'末尾の\を除去
@@ -338,5 +346,5 @@
 
 	Sub SubKey( subkey As String )
-		If IsNothing(subkey) Then Exit Sub
+		If ActiveBasic.IsNothing(subkey) Then Exit Sub
 		This.subkeyname = subkey
 	End Sub
