Added VisualBasic example
This commit is contained in:
parent
6d967c6f3b
commit
199143ec7c
3 changed files with 248 additions and 0 deletions
212
bindings/visual-basic/example/TellStick VB-example - simple.frm
Normal file
212
bindings/visual-basic/example/TellStick VB-example - simple.frm
Normal file
|
@ -0,0 +1,212 @@
|
|||
VERSION 5.00
|
||||
Begin VB.Form frmMain
|
||||
BorderStyle = 4 'Fixed ToolWindow
|
||||
Caption = "TellStick VB-example - simple"
|
||||
ClientHeight = 4680
|
||||
ClientLeft = 2040
|
||||
ClientTop = 3600
|
||||
ClientWidth = 3990
|
||||
Icon = "TellStick VB-example - simple.frx":0000
|
||||
LinkTopic = "Form1"
|
||||
MaxButton = 0 'False
|
||||
MinButton = 0 'False
|
||||
ScaleHeight = 4680
|
||||
ScaleWidth = 3990
|
||||
ShowInTaskbar = 0 'False
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "90%"
|
||||
Height = 465
|
||||
Index = 8
|
||||
Left = 3480
|
||||
TabIndex = 12
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "80%"
|
||||
Height = 465
|
||||
Index = 7
|
||||
Left = 3060
|
||||
TabIndex = 11
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "70%"
|
||||
Height = 465
|
||||
Index = 6
|
||||
Left = 2640
|
||||
TabIndex = 10
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "60%"
|
||||
Height = 465
|
||||
Index = 5
|
||||
Left = 2220
|
||||
TabIndex = 9
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "50%"
|
||||
Height = 465
|
||||
Index = 4
|
||||
Left = 1800
|
||||
TabIndex = 8
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "40%"
|
||||
Height = 465
|
||||
Index = 3
|
||||
Left = 1380
|
||||
TabIndex = 7
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "30%"
|
||||
Height = 465
|
||||
Index = 2
|
||||
Left = 960
|
||||
TabIndex = 6
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "20%"
|
||||
Height = 465
|
||||
Index = 1
|
||||
Left = 540
|
||||
TabIndex = 5
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdDim
|
||||
Caption = "10%"
|
||||
Height = 465
|
||||
Index = 0
|
||||
Left = 120
|
||||
TabIndex = 4
|
||||
Top = 4110
|
||||
Width = 420
|
||||
End
|
||||
Begin VB.CommandButton cmdBell
|
||||
Caption = "Bell"
|
||||
Height = 735
|
||||
Left = 1500
|
||||
Picture = "TellStick VB-example - simple.frx":0ECA
|
||||
Style = 1 'Graphical
|
||||
TabIndex = 3
|
||||
Top = 3285
|
||||
Width = 1000
|
||||
End
|
||||
Begin VB.ListBox deviceList
|
||||
Height = 3180
|
||||
Left = 60
|
||||
TabIndex = 2
|
||||
Top = 60
|
||||
Width = 3810
|
||||
End
|
||||
Begin VB.CommandButton cmdOff
|
||||
Caption = "Off"
|
||||
Height = 735
|
||||
Left = 120
|
||||
Picture = "TellStick VB-example - simple.frx":1794
|
||||
Style = 1 'Graphical
|
||||
TabIndex = 1
|
||||
Top = 3285
|
||||
Width = 1000
|
||||
End
|
||||
Begin VB.CommandButton cmdOn
|
||||
Caption = "On"
|
||||
Height = 735
|
||||
Left = 2900
|
||||
Picture = "TellStick VB-example - simple.frx":205E
|
||||
Style = 1 'Graphical
|
||||
TabIndex = 0
|
||||
Top = 3285
|
||||
Width = 1000
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "frmMain"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Private Sub cmdBell_Click()
|
||||
Dim blnBell As Boolean
|
||||
blnBell = devBell(deviceList.ItemData(deviceList.ListIndex))
|
||||
End Sub
|
||||
|
||||
Private Sub cmdDim_Click(Index As Integer)
|
||||
Dim blnDim As Boolean
|
||||
Dim level As Byte
|
||||
Select Case Index
|
||||
Case "8"
|
||||
level = 230
|
||||
Case "7"
|
||||
level = 204
|
||||
Case "6"
|
||||
level = 179
|
||||
Case "5"
|
||||
level = 153
|
||||
Case "4"
|
||||
level = 128
|
||||
Case "3"
|
||||
level = 102
|
||||
Case "2"
|
||||
level = 77
|
||||
Case "1"
|
||||
level = 51
|
||||
Case "0"
|
||||
level = 25
|
||||
End Select
|
||||
blnDim = devDim(deviceList.ItemData(deviceList.ListIndex), level)
|
||||
End Sub
|
||||
|
||||
Private Sub cmdOff_Click()
|
||||
Dim blnOff As Boolean
|
||||
blnOff = devTurnOff(deviceList.ItemData(deviceList.ListIndex))
|
||||
End Sub
|
||||
|
||||
Private Sub cmdOn_Click()
|
||||
Dim blnOn As Boolean
|
||||
blnOn = devTurnOn(deviceList.ItemData(deviceList.ListIndex))
|
||||
End Sub
|
||||
|
||||
Private Sub deviceList_Click()
|
||||
Dim intMethods As Integer
|
||||
|
||||
intMethods = devMethods(deviceList.ItemData(deviceList.ListIndex))
|
||||
cmdOn.Enabled = (intMethods And TELLSTICK_TURNON)
|
||||
cmdOff.Enabled = (intMethods And TELLSTICK_TURNOFF)
|
||||
cmdBell.Enabled = (intMethods And TELLSTICK_BELL)
|
||||
|
||||
For a = 0 To 8
|
||||
cmdDim(a).Enabled = (intMethods And TELLSTICK_DIM)
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Load()
|
||||
|
||||
Dim numDevices As Integer, i As Integer
|
||||
numDevices = devGetNumberOfDevices()
|
||||
|
||||
For i = 0 To numDevices - 1
|
||||
Dim strName As String
|
||||
Dim intId As Integer
|
||||
|
||||
intId = devGetDeviceId(i)
|
||||
strName = devGetName(intId)
|
||||
deviceList.AddItem strName
|
||||
deviceList.ItemData(i) = intId
|
||||
Next
|
||||
|
||||
deviceList.ListIndex = 0
|
||||
|
||||
End Sub
|
BIN
bindings/visual-basic/example/TellStick VB-example - simple.frx
Normal file
BIN
bindings/visual-basic/example/TellStick VB-example - simple.frx
Normal file
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
Type=Exe
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\..\WINDOWS\system32\STDOLE2.TLB#OLE Automation
|
||||
Form=TellStick VB-example - simple.frm
|
||||
Module=TellStickModule; ..\TellStick.bas
|
||||
Startup="frmMain"
|
||||
HelpFile=""
|
||||
ExeName32="TellStick VB-example - simple.exe"
|
||||
Command32=""
|
||||
Name="TellStickExample"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="0"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionCompanyName="Telldus Technologies"
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=0
|
||||
Unattended=0
|
||||
Retained=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
DebugStartupOption=0
|
||||
|
||||
[MS Transaction Server]
|
||||
AutoRefresh=1
|
Loading…
Add table
Add a link
Reference in a new issue