Option Strict Off Option Explicit On Module wc132 ' declare entry points to WheelCommander DLL Declare Sub NdiCmd_Init Lib "NdiCmdC.dll" Alias "_NdiCmd_Init@0" () Declare Sub NdiCmd_SetLogFile Lib "NdiCmdC.dll" Alias "_NdiCmd_SetLogFile@8" (ByVal path As String, ByVal append As Boolean) Declare Function NdiCmd_Search Lib "NdiCmdC.dll" Alias "_NdiCmd_Search@0" () As Integer Declare Function NdiCmd_CheckPort Lib "NdiCmdC.dll" Alias "_NdiCmd_CheckPort@4" (ByVal port As Integer) As Integer Declare Function NdiCmd_GetFirstPort Lib "NdiCmdC.dll" Alias "_NdiCmd_GetFirstPort@0" () As Integer Declare Function NdiCmd_GetNextPort Lib "NdiCmdC.dll" Alias "_NdiCmd_GetNextPort@4" (ByVal prev As Integer) As Integer Declare Sub NdiCmd_RunWizard Lib "NdiCmdC.dll" Alias "_NdiCmd_RunWizard@4" (ByVal wizMode As Integer) Declare Function NdiCmd_GetWheelCommander Lib "NdiCmdC.dll" Alias "_NdiCmd_GetWheelCommander@0" () As Integer Declare Function NdiCmd_Sync Lib "NdiCmdC.dll" Alias "_NdiCmd_Sync@4" (ByVal handle As Integer) As Integer Declare Function NdiCmd_GetName Lib "NdiCmdC.dll" Alias "_NdiCmd_GetName@12" (ByVal handle As Integer, ByVal name As String, ByRef version As Integer) As Integer Declare Function NdiCmd_Coast Lib "NdiCmdC.dll" Alias "_NdiCmd_Coast@4" (ByVal handle As Integer) As Integer Declare Function NdiCmd_Brake Lib "NdiCmdC.dll" Alias "_NdiCmd_Brake@4" (ByVal handle As Integer) As Integer Declare Function NdiCmd_Reset Lib "NdiCmdC.dll" Alias "_NdiCmd_Reset@4" (ByVal handle As Integer) As Integer Declare Function NdiCmd_Go Lib "NdiCmdC.dll" Alias "_NdiCmd_Go@4" (ByVal handle As Integer) As Integer Declare Function NdiCmd_SetVelocity Lib "NdiCmdC.dll" Alias "_NdiCmd_SetVelocity@8" (ByVal handle As Integer, ByVal vel As Integer) As Integer Declare Function NdiCmd_GetVelocity Lib "NdiCmdC.dll" Alias "_NdiCmd_GetVelocity@8" (ByVal handle As Integer, ByRef vel As Integer) As Integer Declare Function NdiCmd_SetAccel Lib "NdiCmdC.dll" Alias "_NdiCmd_SetAcceleration@8" (ByVal handle As Integer, ByVal vel As Integer) As Integer Declare Function NdiCmd_GetAccel Lib "NdiCmdC.dll" Alias "_NdiCmd_GetAcceleration@8" (ByVal handle As Integer, ByRef vel As Integer) As Integer Declare Function NdiCmd_SetRotation Lib "NdiCmdC.dll" Alias "_NdiCmd_SetRotation@8" (ByVal handle As Integer, ByVal vel As Integer) As Integer Declare Function NdiCmd_GetRotation Lib "NdiCmdC.dll" Alias "_NdiCmd_GetRotation@8" (ByVal handle As Integer, ByRef vel As Integer) As Integer Declare Function NdiCmd_SetAngle Lib "NdiCmdC.dll" Alias "_NdiCmd_SetAngle@8" (ByVal handle As Integer, ByVal vel As Integer) As Integer Declare Function NdiCmd_GetAngle Lib "NdiCmdC.dll" Alias "_NdiCmd_GetAngle@8" (ByVal handle As Integer, ByRef vel As Integer) As Integer Declare Function NdiCmd_SetXAngle Lib "NdiCmdC.dll" Alias "_NdiCmd_SetXAngle@8" (ByVal handle As Integer, ByVal vel As Integer) As Integer Declare Function NdiCmd_GetXAngle Lib "NdiCmdC.dll" Alias "_NdiCmd_GetXAngle@8" (ByVal handle As Integer, ByRef vel As Integer) As Integer Declare Function NdiCmd_SetDist Lib "NdiCmdC.dll" Alias "_NdiCmd_SetDistance@8" (ByVal handle As Integer, ByVal vel As Integer) As Integer Declare Function NdiCmd_GetDist Lib "NdiCmdC.dll" Alias "_NdiCmd_GetDistance@8" (ByVal handle As Integer, ByRef vel As Integer) As Integer Declare Function NdiCmd_SetXDist Lib "NdiCmdC.dll" Alias "_NdiCmd_SetXDistance@8" (ByVal handle As Integer, ByVal vel As Integer) As Integer Declare Function NdiCmd_GetXDist Lib "NdiCmdC.dll" Alias "_NdiCmd_GetXDistance@8" (ByVal handle As Integer, ByRef vel As Integer) As Integer Declare Function NdiCmd_ReadAIO Lib "NdiCmdC.dll" Alias "_NdiCmd_ReadAIO@12" (ByVal handle As Integer, ByVal pin As Integer, ByRef value As Double) As Integer Declare Sub NdiCmd_CloseAllPorts Lib "NdiCmdC.dll" Alias "_NdiCmd_CloseAllPorts@0" () Public handle As Integer ' handle to current WheelCommander Public Function Init_WheelCommander() As Integer handle = -1 NdiCmd_Init() ' init library NdiCmd_SetLogFile("vbcommander.log", False) If NdiCmd_Search <> 1 Then ' try finding WheelCommander NdiCmd_RunWizard(1) ' if it failed, run the wizard If NdiCmd_Search = 1 Then ' try finding it again handle = NdiCmd_GetWheelCommander ' if found, get a handle to the WheelCommander End If Else handle = NdiCmd_GetWheelCommander ' we found it straight away, so get a handle to it End If Init_WheelCommander = handle End Function End Module