Visual Basic Sample
It has come to my attention that the SDK documentation suggests that we have a VB6 sample application. This isn't actually true since the sample was updated to VB.NET. The documentation is out of date.
I have nothing against continuing to distribute a VB6 sample. The problem is I don't have any tools for it. The only VB tools I have at my disposal are all VB.NET. I'm reluctant to keep sending out an application that I can't run, build, edit, or debug cleanly.
So, I'll post the VB6 app source here. No guarantees about future updates or any kind of support, but it is here for anyone who wants it. The text below is the complete listing for Form1.frm which should be everything, aside from adding a reference to PlantronicsDevice.dll in the project.
I have nothing against continuing to distribute a VB6 sample. The problem is I don't have any tools for it. The only VB tools I have at my disposal are all VB.NET. I'm reluctant to keep sending out an application that I can't run, build, edit, or debug cleanly.
So, I'll post the VB6 app source here. No guarantees about future updates or any kind of support, but it is here for anyone who wants it. The text below is the complete listing for Form1.frm which should be everything, aside from adding a reference to PlantronicsDevice.dll in the project.
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Test Plantronics Device"
ClientHeight = 2925
ClientLeft = 1890
ClientTop = 3060
ClientWidth = 5205
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2925
ScaleWidth = 5205
ShowInTaskbar = 0 'False
Begin VB.Timer Timer1
Interval = 100
Left = 4680
Top = 120
End
Begin VB.ListBox m_lstButtons
Height = 2400
Left = 1560
TabIndex = 7
Top = 360
Width = 3495
End
Begin VB.CheckBox m_chkSmart
Caption = "Smart"
Enabled = 0 'False
Height = 495
Left = 120
TabIndex = 5
TabStop = 0 'False
Top = 2280
Width = 1215
End
Begin VB.CheckBox m_chkFlash2
Caption = "Flash 2"
Enabled = 0 'False
Height = 495
Left = 120
TabIndex = 4
TabStop = 0 'False
Top = 1920
Width = 1215
End
Begin VB.CheckBox m_chkFlash1
Caption = "Flash 1"
Enabled = 0 'False
Height = 495
Left = 120
TabIndex = 3
TabStop = 0 'False
Top = 1560
Width = 1215
End
Begin VB.CheckBox m_chkTalk
Caption = "Talk"
Enabled = 0 'False
Height = 495
Left = 120
TabIndex = 2
TabStop = 0 'False
Top = 1200
Width = 1215
End
Begin VB.CheckBox m_chkRinger
Caption = "&Ringer"
Enabled = 0 'False
Height = 495
Left = 120
TabIndex = 1
Top = 840
Width = 1215
End
Begin VB.CheckBox m_chkAudioEnabled
Caption = "&AudioEnabled"
Enabled = 0 'False
Height = 495
Left = 120
TabIndex = 0
Top = 480
Width = 1335
End
Begin VB.CheckBox m_chkAttached
Caption = "Attached"
Enabled = 0 'False
Height = 495
Left = 120
TabIndex = 8
TabStop = 0 'False
Top = 120
Width = 1215
End
Begin VB.Label Label1
Caption = "&Buttons:"
Height = 255
Left = 1560
TabIndex = 6
Top = 120
Width = 735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const COUNTER = 10
Dim WithEvents m_device As CDevice
Attribute m_device.VB_VarHelpID = -1
Dim m_talkCounter As Integer
Dim m_flash1Counter As Integer
Dim m_flash2Counter As Integer
Dim m_smartCounter As Integer
Private Sub Form_Load()
Set m_device = New CDevice
m_device.StartupPNP
End Sub
Private Sub Form_Unload(Cancel As Integer)
m_device.ShutdownPNP
End Sub
Private Sub m_chkAudioEnabled_Click()
If m_device.IsAttached Then
m_device.AudioEnabled = m_chkAudioEnabled.Value
End If
End Sub
Private Sub m_chkRinger_Click()
If m_device.IsAttached Then
m_device.Ringer = m_chkRinger.Value
End If
End Sub
Private Sub m_device_AudioEnabledChanged(ByVal pSender As Object, ByVal bAudioEnabled As Boolean)
m_chkAudioEnabled.Value = IIf(bAudioEnabled, 1, 0)
End Sub
Private Sub m_device_ButtonPressed(ByVal pSender As Object, ByVal Button As PlantronicsDevice.Button)
m_lstButtons.AddItem (CStr(Button) + " pressed")
End Sub
Private Sub m_device_DeviceAttached(ByVal pSender As Object)
m_chkAttached.Value = 1
m_chkAudioEnabled.Enabled = True
m_chkAudioEnabled.Value = IIf(m_device.AudioEnabled, 1, 0)
m_chkRinger.Enabled = True
m_device.Ringer = False
m_chkRinger.Value = 0
End Sub
Private Sub m_device_DeviceDetached(ByVal pSender As Object)
m_chkAttached.Value = 0
m_chkAudioEnabled.Enabled = False
m_chkAudioEnabled.Value = 0
m_chkRinger.Enabled = False
m_chkRinger.Value = 0
End Sub
Private Sub m_device_FlashPressed(ByVal pSender As Object, ByVal nButton As Long)
Select Case nButton
Case 0
m_chkFlash1.Value = 1
m_flash1Counter = COUNTER
Case 1
m_chkFlash2.Value = 1
m_flash2Counter = COUNTER
End Select
End Sub
Private Sub m_device_SmartPressed(ByVal pSender As Object)
m_chkSmart.Value = 1
m_smartCounter = COUNTER
End Sub
Private Sub m_device_TalkPressed(ByVal pSender As Object)
m_chkTalk.Value = 1
m_talkCounter = COUNTER
End Sub
' turn off the checkboxes after 1 second
Private Sub Timer1_Timer()
If m_talkCounter > 1 Then
m_talkCounter = m_talkCounter - 1
ElseIf m_talkCounter = 1 Then
m_talkCounter = 0
m_chkTalk.Value = 0
End If
If m_flash1Counter > 1 Then
m_flash1Counter = m_flash1Counter - 1
ElseIf m_flash1Counter = 1 Then
m_flash1Counter = 0
m_chkFlash1.Value = 0
End If
If m_flash2Counter > 1 Then
m_flash2Counter = m_flash2Counter - 1
ElseIf m_flash2Counter = 1 Then
m_flash2Counter = 0
m_chkFlash2.Value = 0
End If
If m_smartCounter > 1 Then
m_smartCounter = m_smartCounter - 1
ElseIf m_smartCounter = 1 Then
m_smartCounter = 0
m_chkSmart.Value = 0
End If
End Sub


0 Comments:
Post a Comment
<< Home