home *** CD-ROM | disk | FTP | other *** search
/ Microsoft DirectX SDK 7.0 / Dx7.bin / DXF / samples / multimedia / vbsamples / dinput / src / ffeedback / forcefeedback.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-05  |  62.3 KB  |  1,333 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx"
  3. Begin VB.Form frmForceFeedback 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "VB Force Feedback"
  6.    ClientHeight    =   7020
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   9315
  10.    Icon            =   "ForceFeedback.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   7020
  15.    ScaleWidth      =   9315
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.Frame frameDirection 
  18.       Caption         =   "Direction"
  19.       Height          =   2895
  20.       Left            =   6720
  21.       TabIndex        =   70
  22.       Top             =   3960
  23.       Width           =   2415
  24.       Begin VB.OptionButton optDirection 
  25.          Caption         =   "Option1"
  26.          Height          =   210
  27.          Index           =   0
  28.          Left            =   1080
  29.          TabIndex        =   78
  30.          Top             =   480
  31.          Value           =   -1  'True
  32.          Width           =   200
  33.       End
  34.       Begin VB.OptionButton optDirection 
  35.          Caption         =   "Option2"
  36.          Height          =   210
  37.          Index           =   4
  38.          Left            =   1080
  39.          TabIndex        =   77
  40.          Top             =   2280
  41.          Width           =   200
  42.       End
  43.       Begin VB.OptionButton optDirection 
  44.          Caption         =   "Option3"
  45.          Height          =   210
  46.          Index           =   6
  47.          Left            =   240
  48.          TabIndex        =   76
  49.          Top             =   1380
  50.          Width           =   200
  51.       End
  52.       Begin VB.OptionButton optDirection 
  53.          Caption         =   "Option4"
  54.          Height          =   210
  55.          Index           =   2
  56.          Left            =   1920
  57.          TabIndex        =   75
  58.          Top             =   1320
  59.          Width           =   200
  60.       End
  61.       Begin VB.OptionButton optDirection 
  62.          Caption         =   "Option5"
  63.          Height          =   210
  64.          Index           =   7
  65.          Left            =   480
  66.          TabIndex        =   74
  67.          Top             =   840
  68.          Width           =   200
  69.       End
  70.       Begin VB.OptionButton optDirection 
  71.          Caption         =   "Option6"
  72.          Height          =   210
  73.          Index           =   1
  74.          Left            =   1680
  75.          TabIndex        =   73
  76.          Top             =   840
  77.          Width           =   200
  78.       End
  79.       Begin VB.OptionButton optDirection 
  80.          Caption         =   "Option7"
  81.          Height          =   210
  82.          Index           =   5
  83.          Left            =   480
  84.          TabIndex        =   72
  85.          Top             =   1920
  86.          Width           =   200
  87.       End
  88.       Begin VB.OptionButton optDirection 
  89.          Caption         =   "Option8"
  90.          Height          =   210
  91.          Index           =   3
  92.          Left            =   1680
  93.          TabIndex        =   71
  94.          Top             =   1920
  95.          Width           =   200
  96.       End
  97.    End
  98.    Begin VB.Frame frameEnvelope 
  99.       Caption         =   "Envelope"
  100.       Height          =   2895
  101.       Left            =   3720
  102.       TabIndex        =   56
  103.       Top             =   3960
  104.       Width           =   2775
  105.       Begin MSComctlLib.Slider sldEnvelope 
  106.          Height          =   255
  107.          Index           =   0
  108.          Left            =   240
  109.          TabIndex        =   58
  110.          Top             =   855
  111.          Width           =   2295
  112.          _ExtentX        =   4048
  113.          _ExtentY        =   450
  114.          _Version        =   393216
  115.          LargeChange     =   100
  116.          SmallChange     =   10
  117.          Max             =   10000
  118.          SelStart        =   10000
  119.          TickFrequency   =   1000
  120.          Value           =   10000
  121.       End
  122.       Begin VB.CheckBox chkEnvelope 
  123.          Caption         =   "Use envelope"
  124.          Height          =   255
  125.          Left            =   720
  126.          TabIndex        =   57
  127.          Top             =   280
  128.          Width           =   1335
  129.       End
  130.       Begin MSComctlLib.Slider sldEnvelope 
  131.          Height          =   255
  132.          Index           =   1
  133.          Left            =   240
  134.          TabIndex        =   59
  135.          Top             =   1380
  136.          Width           =   2295
  137.          _ExtentX        =   4048
  138.          _ExtentY        =   450
  139.          _Version        =   393216
  140.          LargeChange     =   10000
  141.          SmallChange     =   1000
  142.          Max             =   5000000
  143.          TickFrequency   =   500000
  144.       End
  145.       Begin MSComctlLib.Slider sldEnvelope 
  146.          Height          =   255
  147.          Index           =   2
  148.          Left            =   240
  149.          TabIndex        =   60
  150.          Top             =   1965
  151.          Width           =   2295
  152.          _ExtentX        =   4048
  153.          _ExtentY        =   450
  154.          _Version        =   393216
  155.          LargeChange     =   100
  156.          SmallChange     =   10
  157.          Max             =   10000
  158.          SelStart        =   10000
  159.          TickFrequency   =   1000
  160.          Value           =   10000
  161.       End
  162.       Begin MSComctlLib.Slider sldEnvelope 
  163.          Height          =   255
  164.          Index           =   3
  165.          Left            =   240
  166.          TabIndex        =   61
  167.          Top             =   2520
  168.          Width           =   2295
  169.          _ExtentX        =   4048
  170.          _ExtentY        =   450
  171.          _Version        =   393216
  172.          LargeChange     =   1000
  173.          SmallChange     =   100
  174.          Max             =   5000000
  175.          TickFrequency   =   500000
  176.       End
  177.       Begin VB.Label lblEnvelope 
  178.          AutoSize        =   -1  'True
  179.          Caption         =   "0"
  180.          Height          =   195
  181.          Index           =   3
  182.          Left            =   1440
  183.          TabIndex        =   69
  184.          Top             =   2325
  185.          Width           =   90
  186.       End
  187.       Begin VB.Label lblEnvelope 
  188.          AutoSize        =   -1  'True
  189.          Caption         =   "10000"
  190.          Height          =   195
  191.          Index           =   2
  192.          Left            =   1440
  193.          TabIndex        =   68
  194.          Top             =   1740
  195.          Width           =   450
  196.       End
  197.       Begin VB.Label lblEnvelope 
  198.          AutoSize        =   -1  'True
  199.          Caption         =   "0"
  200.          Height          =   195
  201.          Index           =   1
  202.          Left            =   1440
  203.          TabIndex        =   67
  204.          Top             =   1170
  205.          Width           =   90
  206.       End
  207.       Begin VB.Label lblEnvelope 
  208.          AutoSize        =   -1  'True
  209.          Caption         =   "10000"
  210.          Height          =   195
  211.          Index           =   0
  212.          Left            =   1440
  213.          TabIndex        =   66
  214.          Top             =   600
  215.          Width           =   450
  216.       End
  217.       Begin VB.Label Label20 
  218.          AutoSize        =   -1  'True
  219.          Caption         =   "Fade Time:"
  220.          Height          =   195
  221.          Left            =   510
  222.          TabIndex        =   65
  223.          Top             =   2325
  224.          Width           =   795
  225.       End
  226.       Begin VB.Label Label19 
  227.          AutoSize        =   -1  'True
  228.          Caption         =   "Fade Level:"
  229.          Height          =   195
  230.          Left            =   465
  231.          TabIndex        =   64
  232.          Top             =   1740
  233.          Width           =   840
  234.       End
  235.       Begin VB.Label Label18 
  236.          AutoSize        =   -1  'True
  237.          Caption         =   "Attack Time:"
  238.          Height          =   195
  239.          Left            =   405
  240.          TabIndex        =   63
  241.          Top             =   1170
  242.          Width           =   900
  243.       End
  244.       Begin VB.Label Label17 
  245.          AutoSize        =   -1  'True
  246.          Caption         =   "Attack Level:"
  247.          Height          =   195
  248.          Left            =   360
  249.          TabIndex        =   62
  250.          Top             =   600
  251.          Width           =   945
  252.       End
  253.    End
  254.    Begin VB.Frame frameTypeContainer 
  255.       Caption         =   "Type-Specific Parameters"
  256.       Height          =   3495
  257.       Left            =   3720
  258.       TabIndex        =   12
  259.       Top             =   240
  260.       Width           =   5415
  261.       Begin VB.Frame frameCondition 
  262.          Caption         =   "Conditional Force"
  263.          Height          =   3015
  264.          Left            =   120
  265.          TabIndex        =   37
  266.          Top             =   240
  267.          Visible         =   0   'False
  268.          Width           =   5175
  269.          Begin VB.OptionButton optConditionAxis 
  270.             Caption         =   "Y Axis"
  271.             Height          =   255
  272.             Index           =   1
  273.             Left            =   2280
  274.             TabIndex        =   80
  275.             Top             =   2700
  276.             Width           =   735
  277.          End
  278.          Begin VB.OptionButton optConditionAxis 
  279.             Caption         =   "X Axis"
  280.             Height          =   255
  281.             Index           =   0
  282.             Left            =   2280
  283.             TabIndex        =   79
  284.             Top             =   2440
  285.             Value           =   -1  'True
  286.             Width           =   735
  287.          End
  288.          Begin MSComctlLib.Slider sldCondition 
  289.             Height          =   255
  290.             Index           =   0
  291.             Left            =   240
  292.             TabIndex        =   38
  293.             Top             =   600
  294.             Width           =   2055
  295.             _ExtentX        =   3625
  296.             _ExtentY        =   450
  297.             _Version        =   393216
  298.             LargeChange     =   100
  299.             SmallChange     =   10
  300.             Max             =   10000
  301.             TickFrequency   =   1000
  302.          End
  303.          Begin MSComctlLib.Slider sldCondition 
  304.             Height          =   255
  305.             Index           =   1
  306.             Left            =   240
  307.             TabIndex        =   39
  308.             Top             =   1320
  309.             Width           =   2055
  310.             _ExtentX        =   3625
  311.             _ExtentY        =   450
  312.             _Version        =   393216
  313.             LargeChange     =   100
  314.             SmallChange     =   10
  315.             Min             =   -10000
  316.             Max             =   10000
  317.             TickFrequency   =   1000
  318.          End
  319.          Begin MSComctlLib.Slider sldCondition 
  320.             Height          =   255
  321.             Index           =   2
  322.             Left            =   240
  323.             TabIndex        =   40
  324.             Top             =   2160
  325.             Width           =   2055
  326.             _ExtentX        =   3625
  327.             _ExtentY        =   450
  328.             _Version        =   393216
  329.             LargeChange     =   100
  330.             SmallChange     =   10
  331.             Max             =   10000
  332.             SelStart        =   10000
  333.             TickFrequency   =   1000
  334.             Value           =   10000
  335.          End
  336.          Begin MSComctlLib.Slider sldCondition 
  337.             Height          =   255
  338.             Index           =   3
  339.             Left            =   2880
  340.             TabIndex        =   41
  341.             Top             =   600
  342.             Width           =   2055
  343.             _ExtentX        =   3625
  344.             _ExtentY        =   450
  345.             _Version        =   393216
  346.             LargeChange     =   100
  347.             SmallChange     =   10
  348.             Min             =   -10000
  349.             Max             =   10000
  350.             TickFrequency   =   1000
  351.          End
  352.          Begin MSComctlLib.Slider sldCondition 
  353.             Height          =   255
  354.             Index           =   4
  355.             Left            =   2880
  356.             TabIndex        =   42
  357.             Top             =   1320
  358.             Width           =   2055
  359.             _ExtentX        =   3625
  360.             _ExtentY        =   450
  361.             _Version        =   393216
  362.             LargeChange     =   100
  363.             SmallChange     =   10
  364.             Min             =   -10000
  365.             Max             =   10000
  366.             TickFrequency   =   1000
  367.          End
  368.          Begin MSComctlLib.Slider sldCondition 
  369.             Height          =   255
  370.             Index           =   5
  371.             Left            =   2880
  372.             TabIndex        =   43
  373.             Top             =   2160
  374.             Width           =   2055
  375.             _ExtentX        =   3625
  376.             _ExtentY        =   450
  377.             _Version        =   393216
  378.             LargeChange     =   100
  379.             SmallChange     =   10
  380.             Max             =   10000
  381.             SelStart        =   10000
  382.             TickFrequency   =   1000
  383.             Value           =   10000
  384.          End
  385.          Begin VB.Label Label11 
  386.             AutoSize        =   -1  'True
  387.             Caption         =   "Dead band:"
  388.             Height          =   195
  389.             Left            =   240
  390.             TabIndex        =   55
  391.             Top             =   360
  392.             Width           =   840
  393.          End
  394.          Begin VB.Label Label12 
  395.             AutoSize        =   -1  'True
  396.             Caption         =   "Negative Coefficient:"
  397.             Height          =   195
  398.             Left            =   240
  399.             TabIndex        =   54
  400.             Top             =   1080
  401.             Width           =   1455
  402.          End
  403.          Begin VB.Label Label13 
  404.             AutoSize        =   -1  'True
  405.             Caption         =   "Negative Saturation:"
  406.             Height          =   195
  407.             Left            =   240
  408.             TabIndex        =   53
  409.             Top             =   1920
  410.             Width           =   1455
  411.          End
  412.          Begin VB.Label Label14 
  413.             AutoSize        =   -1  'True
  414.             Caption         =   "Offset:"
  415.             Height          =   195
  416.             Left            =   3120
  417.             TabIndex        =   52
  418.             Top             =   360
  419.             Width           =   465
  420.          End
  421.          Begin VB.Label Label15 
  422.             AutoSize        =   -1  'True
  423.             Caption         =   "Positive Coefficient:"
  424.             Height          =   195
  425.             Left            =   3000
  426.             TabIndex        =   51
  427.             Top             =   1080
  428.             Width           =   1365
  429.          End
  430.          Begin VB.Label Label16 
  431.             AutoSize        =   -1  'True
  432.             Caption         =   "Positive Saturation:"
  433.             Height          =   195
  434.             Left            =   3000
  435.             TabIndex        =   50
  436.             Top             =   1920
  437.             Width           =   1365
  438.          End
  439.          Begin VB.Label lblCondition 
  440.             AutoSize        =   -1  'True
  441.             Caption         =   "0"
  442.             Height          =   195
  443.             Index           =   0
  444.             Left            =   1200
  445.             TabIndex        =   49
  446.             Top             =   360
  447.             Width           =   90
  448.          End
  449.          Begin VB.Label lblCondition 
  450.             AutoSize        =   -1  'True
  451.             Caption         =   "0"
  452.             Height          =   195
  453.             Index           =   1
  454.             Left            =   1800
  455.             TabIndex        =   48
  456.             Top             =   1080
  457.             Width           =   90
  458.          End
  459.          Begin VB.Label lblCondition 
  460.             AutoSize        =   -1  'True
  461.             Caption         =   "10000"
  462.             Height          =   195
  463.             Index           =   2
  464.             Left            =   1800
  465.             TabIndex        =   47
  466.             Top             =   1920
  467.             Width           =   450
  468.          End
  469.          Begin VB.Label lblCondition 
  470.             AutoSize        =   -1  'True
  471.             Caption         =   "0"
  472.             Height          =   195
  473.             Index           =   3
  474.             Left            =   3600
  475.             TabIndex        =   46
  476.             Top             =   360
  477.             Width           =   90
  478.          End
  479.          Begin VB.Label lblCondition 
  480.             AutoSize        =   -1  'True
  481.             Caption         =   "0"
  482.             Height          =   195
  483.             Index           =   4
  484.             Left            =   4440
  485.             TabIndex        =   45
  486.             Top             =   1080
  487.             Width           =   90
  488.          End
  489.          Begin VB.Label lblCondition 
  490.             AutoSize        =   -1  'True
  491.             Caption         =   "10000"
  492.             Height          =   195
  493.             Index           =   5
  494.             Left            =   4410
  495.             TabIndex        =   44
  496.             Top             =   1920
  497.             Width           =   450
  498.          End
  499.       End
  500.       Begin VB.Frame framePeriodic 
  501.          Caption         =   "Periodic Force"
  502.          Height          =   3015
  503.          Left            =   120
  504.          TabIndex        =   24
  505.          Top             =   240
  506.          Visible         =   0   'False
  507.          Width           =   5175
  508.          Begin MSComctlLib.Slider sldPeriodic 
  509.             Height          =   255
  510.             Index           =   0
  511.             Left            =   600
  512.             TabIndex        =   25
  513.             Top             =   480
  514.             Width           =   4095
  515.             _ExtentX        =   7223
  516.             _ExtentY        =   450
  517.             _Version        =   393216
  518.             LargeChange     =   100
  519.             SmallChange     =   10
  520.             Max             =   10000
  521.             TickFrequency   =   1000
  522.          End
  523.          Begin MSComctlLib.Slider sldPeriodic 
  524.             Height          =   255
  525.             Index           =   1
  526.             Left            =   600
  527.             TabIndex        =   26
  528.             Top             =   1080
  529.             Width           =   4095
  530.             _ExtentX        =   7223
  531.             _ExtentY        =   450
  532.             _Version        =   393216
  533.             LargeChange     =   1000
  534.             SmallChange     =   100
  535.             Min             =   -10000
  536.             Max             =   10000
  537.             TickFrequency   =   1000
  538.          End
  539.          Begin MSComctlLib.Slider sldPeriodic 
  540.             Height          =   255
  541.             Index           =   2
  542.             Left            =   600
  543.             TabIndex        =   27
  544.             Top             =   1800
  545.             Width           =   4095
  546.             _ExtentX        =   7223
  547.             _ExtentY        =   450
  548.             _Version        =   393216
  549.             LargeChange     =   1000
  550.             SmallChange     =   100
  551.             Max             =   35999
  552.             TickFrequency   =   1000
  553.          End
  554.          Begin MSComctlLib.Slider sldPeriodic 
  555.             Height          =   255
  556.             Index           =   3
  557.             Left            =   600
  558.             TabIndex        =   28
  559.             Top             =   2520
  560.             Width           =   4095
  561.             _ExtentX        =   7223
  562.             _ExtentY        =   450
  563.             _Version        =   393216
  564.             LargeChange     =   1000
  565.             SmallChange     =   100
  566.             Max             =   500000
  567.             TickFrequency   =   10000
  568.          End
  569.          Begin VB.Label lblPeriodic 
  570.             AutoSize        =   -1  'True
  571.             Caption         =   "0"
  572.             Height          =   195
  573.             Index           =   3
  574.             Left            =   2400
  575.             TabIndex        =   36
  576.             Top             =   2280
  577.             Width           =   90
  578.          End
  579.          Begin VB.Label Label10 
  580.             AutoSize        =   -1  'True
  581.             Caption         =   "Period:"
  582.             Height          =   195
  583.             Left            =   1800
  584.             TabIndex        =   35
  585.             Top             =   2280
  586.             Width           =   495
  587.          End
  588.          Begin VB.Label lblPeriodic 
  589.             AutoSize        =   -1  'True
  590.             Caption         =   "0"
  591.             Height          =   195
  592.             Index           =   2
  593.             Left            =   2400
  594.             TabIndex        =   34
  595.             Top             =   1560
  596.             Width           =   90
  597.          End
  598.          Begin VB.Label Label9 
  599.             AutoSize        =   -1  'True
  600.             Caption         =   "Phase:"
  601.             Height          =   195
  602.             Left            =   1800
  603.             TabIndex        =   33
  604.             Top             =   1560
  605.             Width           =   495
  606.          End
  607.          Begin VB.Label lblPeriodic 
  608.             AutoSize        =   -1  'True
  609.             Caption         =   "0"
  610.             Height          =   195
  611.             Index           =   1
  612.             Left            =   2400
  613.             TabIndex        =   32
  614.             Top             =   840
  615.             Width           =   90
  616.          End
  617.          Begin VB.Label Label8 
  618.             AutoSize        =   -1  'True
  619.             Caption         =   "Offset:"
  620.             Height          =   195
  621.             Left            =   1800
  622.             TabIndex        =   31
  623.             Top             =   840
  624.             Width           =   465
  625.          End
  626.          Begin VB.Label lblPeriodic 
  627.             AutoSize        =   -1  'True
  628.             Caption         =   "0"
  629.             Height          =   195
  630.             Index           =   0
  631.             Left            =   2400
  632.             TabIndex        =   30
  633.             Top             =   240
  634.             Width           =   90
  635.          End
  636.          Begin VB.Label Label7 
  637.             AutoSize        =   -1  'True
  638.             Caption         =   "Magnitude:"
  639.             Height          =   195
  640.             Left            =   1560
  641.             TabIndex        =   29
  642.             Top             =   240
  643.             Width           =   795
  644.          End
  645.       End
  646.       Begin VB.Frame frameRampForce 
  647.          Caption         =   "Ramp Force"
  648.          Height          =   3015
  649.          Left            =   120
  650.          TabIndex        =   17
  651.          Top             =   240
  652.          Width           =   5175
  653.          Begin MSComctlLib.Slider sldRampRange 
  654.             Height          =   495
  655.             Index           =   0
  656.             Left            =   480
  657.             TabIndex        =   18
  658.             Top             =   840
  659.             Width           =   4215
  660.             _ExtentX        =   7435
  661.             _ExtentY        =   873
  662.             _Version        =   393216
  663.             LargeChange     =   1000
  664.             SmallChange     =   100
  665.             Min             =   -10000
  666.             Max             =   10000
  667.             TickFrequency   =   1000
  668.          End
  669.          Begin MSComctlLib.Slider sldRampRange 
  670.             Height          =   495
  671.             Index           =   1
  672.             Left            =   480
  673.             TabIndex        =   19
  674.             Top             =   1920
  675.             Width           =   4215
  676.             _ExtentX        =   7435
  677.             _ExtentY        =   873
  678.             _Version        =   393216
  679.             LargeChange     =   1000
  680.             SmallChange     =   100
  681.             Min             =   -10000
  682.             Max             =   10000
  683.             TickFrequency   =   1000
  684.          End
  685.          Begin VB.Label lblRange 
  686.             AutoSize        =   -1  'True
  687.             Caption         =   "0"
  688.             Height          =   195
  689.             Index           =   1
  690.             Left            =   2400
  691.             TabIndex        =   23
  692.             Top             =   1680
  693.             Width           =   90
  694.          End
  695.          Begin VB.Label Label2 
  696.             AutoSize        =   -1  'True
  697.             Caption         =   "Range End:"
  698.             Height          =   195
  699.             Left            =   1440
  700.             TabIndex        =   22
  701.             Top             =   1680
  702.             Width           =   855
  703.          End
  704.          Begin VB.Label lblRange 
  705.             AutoSize        =   -1  'True
  706.             Caption         =   "0"
  707.             Height          =   195
  708.             Index           =   0
  709.             Left            =   2400
  710.             TabIndex        =   21
  711.             Top             =   600
  712.             Width           =   90
  713.          End
  714.          Begin VB.Label Label1 
  715.             AutoSize        =   -1  'True
  716.             Caption         =   "Range Start:"
  717.             Height          =   195
  718.             Left            =   1440
  719.             TabIndex        =   20
  720.             Top             =   600
  721.             Width           =   900
  722.          End
  723.       End
  724.       Begin VB.Frame frameConstantForce 
  725.          Caption         =   "Constant Force"
  726.          Height          =   3015
  727.          Left            =   120
  728.          TabIndex        =   13
  729.          Top             =   240
  730.          Visible         =   0   'False
  731.          Width           =   5175
  732.          Begin MSComctlLib.Slider sldConstantForce 
  733.             Height          =   495
  734.             Left            =   840
  735.             TabIndex        =   14
  736.             Top             =   1320
  737.             Width           =   3615
  738.             _ExtentX        =   6376
  739.             _ExtentY        =   873
  740.             _Version        =   393216
  741.             LargeChange     =   100
  742.             SmallChange     =   10
  743.             Max             =   10000
  744.             SelStart        =   10000
  745.             TickFrequency   =   1000
  746.             Value           =   10000
  747.          End
  748.          Begin VB.Label lblConstantForce 
  749.             AutoSize        =   -1  'True
  750.             Caption         =   "10000"
  751.             Height          =   195
  752.             Left            =   3360
  753.             TabIndex        =   16
  754.             Top             =   1080
  755.             Width           =   450
  756.          End
  757.          Begin VB.Label Label5 
  758.             AutoSize        =   -1  'True
  759.             Caption         =   "Constant Force Magnitude:"
  760.             Height          =   195
  761.             Left            =   1320
  762.             TabIndex        =   15
  763.             Top             =   1080
  764.             Width           =   1920
  765.          End
  766.       End
  767.    End
  768.    Begin VB.Frame frmGeneral 
  769.       Caption         =   "General Parameters"
  770.       Height          =   2895
  771.       Left            =   120
  772.       TabIndex        =   1
  773.       Top             =   3960
  774.       Width           =   3375
  775.       Begin MSComctlLib.Slider sldDuration 
  776.          Height          =   495
  777.          Left            =   240
  778.          TabIndex        =   2
  779.          Top             =   600
  780.          Width           =   2775
  781.          _ExtentX        =   4895
  782.          _ExtentY        =   873
  783.          _Version        =   393216
  784.          LargeChange     =   100
  785.          SmallChange     =   10
  786.          Min             =   1
  787.          Max             =   50001
  788.          SelStart        =   50001
  789.          TickFrequency   =   5000
  790.          Value           =   50001
  791.       End
  792.       Begin MSComctlLib.Slider sldGain 
  793.          Height          =   495
  794.          Left            =   240
  795.          TabIndex        =   5
  796.          Top             =   1320
  797.          Width           =   2775
  798.          _ExtentX        =   4895
  799.          _ExtentY        =   873
  800.          _Version        =   393216
  801.          LargeChange     =   100
  802.          SmallChange     =   10
  803.          Max             =   10000
  804.          SelStart        =   10000
  805.          TickFrequency   =   1000
  806.          Value           =   10000
  807.       End
  808.       Begin MSComctlLib.Slider sldSamplePeriod 
  809.          Height          =   495
  810.          Left            =   240
  811.          TabIndex        =   9
  812.          Top             =   2160
  813.          Width           =   2775
  814.          _ExtentX        =   4895
  815.          _ExtentY        =   873
  816.          _Version        =   393216
  817.          LargeChange     =   1000
  818.          SmallChange     =   100
  819.          Max             =   100000
  820.          TickFrequency   =   10000
  821.       End
  822.       Begin VB.Label lblSamplePeriod 
  823.          AutoSize        =   -1  'True
  824.          Caption         =   "Default"
  825.          Height          =   195
  826.          Left            =   1320
  827.          TabIndex        =   11
  828.          Top             =   1920
  829.          Width           =   510
  830.       End
  831.       Begin VB.Label Label6 
  832.          AutoSize        =   -1  'True
  833.          Caption         =   "Sample rate:"
  834.          Height          =   195
  835.          Left            =   360
  836.          TabIndex        =   10
  837.          Top             =   1920
  838.          Width           =   885
  839.       End
  840.       Begin VB.Label lblGain 
  841.          AutoSize        =   -1  'True
  842.          Caption         =   "10000"
  843.          Height          =   195
  844.          Left            =   1200
  845.          TabIndex        =   7
  846.          Top             =   1080
  847.          Width           =   450
  848.       End
  849.       Begin VB.Label Label4 
  850.          AutoSize        =   -1  'True
  851.          Caption         =   "Effect gain:"
  852.          Height          =   195
  853.          Left            =   360
  854.          TabIndex        =   6
  855.          Top             =   1080
  856.          Width           =   810
  857.       End
  858.       Begin VB.Label lblDuration 
  859.          AutoSize        =   -1  'True
  860.          Caption         =   "Infinite"
  861.          Height          =   195
  862.          Left            =   1560
  863.          TabIndex        =   4
  864.          Top             =   360
  865.          Width           =   465
  866.       End
  867.       Begin VB.Label Label3 
  868.          AutoSize        =   -1  'True
  869.          Caption         =   "Effect Duration:"
  870.          Height          =   195
  871.          Left            =   360
  872.          TabIndex        =   3
  873.          Top             =   360
  874.          Width           =   1110
  875.       End
  876.    End
  877.    Begin VB.ListBox lstEffects 
  878.       Height          =   3375
  879.       Left            =   120
  880.       TabIndex        =   0
  881.       Top             =   360
  882.       Width           =   3375
  883.    End
  884.    Begin VB.Label lblAvailable 
  885.       AutoSize        =   -1  'True
  886.       Caption         =   "Available effects:"
  887.       Height          =   195
  888.       Left            =   120
  889.       TabIndex        =   8
  890.       Top             =   120
  891.       Width           =   1215
  892.    End
  893. Attribute VB_Name = "frmForceFeedback"
  894. Attribute VB_GlobalNameSpace = False
  895. Attribute VB_Creatable = False
  896. Attribute VB_PredeclaredId = True
  897. Attribute VB_Exposed = False
  898. Option Explicit
  899. Dim dx As New DirectX7                                  'DirectX 7 object
  900. Dim di As DirectInput                                   'DirectInput object
  901. Dim diJoystick As DirectInputDevice                     'DirectInput device object
  902. Dim enumDevice As DirectInputEnumDevices                'DirectInput enumeration for devices object
  903. Dim diEnumObjects As DirectInputEnumDeviceObjects       'DirectInput enumeration for objects on a device object
  904. Dim diDevObjInstance As DirectInputDeviceObjectInstance 'DirectInput object on a device object
  905. Dim diEffEnum As DirectInputEnumEffects                 'DirectInput enumeration for force feedback effects object
  906. Dim diFFEffect() As DirectInputEffect                   'Force feedback effects object
  907. Dim diEffectType As Long                                'Will be used to store the type of effect an effect object is
  908. Dim diFFStaticParams As Long                            'Will be used to store the static parameters of an effect object
  909. Dim EffectParams() As Long                              'Used to store the type of effect it is
  910. Dim Button() As Long                                    'Will be used to store the offset of all the buttons on diJoystick
  911. Dim Caps As DIDEVCAPS                                   'Will be used to store the capabilities of the diJoystick
  912. Dim lngLastEffectIndex As Long                          'Will be used to store the last effect
  913. Private Function CreateFFEffect(Index As Integer) As DIEFFECT
  914.     'This sub creates a generic effect DIEFFECT structure to be used in creating the effect
  915.     With CreateFFEffect
  916.         .lDuration = -1                                 'Infinite duration
  917.         .lGain = 10000                                  'Full gain
  918.         .lSamplePeriod = 0                              'Default sample period
  919.         .lTriggerButton = Button(1)                     'Use button 1 on the joystick as the trigger
  920.         .lTriggerRepeatInterval = -1                    'Turn off trigger repeat interval
  921.                 
  922.         .constantForce.lMagnitude = 10000               'Make the magnitude of a constant force effect at full
  923.         .rampForce.lRangeStart = 0                      'Make the magnitude at the start of a ramp force 0
  924.         .rampForce.lRangeEnd = 0                        'Make the magnitude at the end of a ramp force 0
  925.         .conditionFlags = DICONDITION_USE_BOTH_AXES     'Use both axis when using a conditional force
  926.         With .conditionX                                'For the X axis
  927.             .lDeadBand = 0                              'Make an effect with no deadband
  928.             .lNegativeSaturation = 10000                'Turn the negative saturation all the way up
  929.             .lOffset = 0                                'Zero the offset
  930.             .lPositiveSaturation = 10000                'Turn the positive saturation all the way up
  931.         End With
  932.         With .conditionY                                'For the Y axis
  933.             .lDeadBand = 0                              'Make an effect with no deadband
  934.             .lNegativeSaturation = 10000                'Turn the negative saturation all the way up
  935.             .lOffset = 0                                'Zero the offset
  936.             .lPositiveSaturation = 10000                'Turn the positive saturation all the way up
  937.         End With
  938.         With .periodicForce                             'For a periodic force
  939.             .lMagnitude = 10000                         'Turn the magnitude of the force all the way up
  940.             .lOffset = 0                                'Zero the offset
  941.             .lPeriod = 1                                'Set the length of a cycle to 1
  942.             .lPhase = 0                                 'Zero the starting phase. Phase is something that has very
  943.                                                         'limited support, so changing this parameter will almost always
  944.                                                         'fail. Be prepared to catch the error this will return.
  945.         End With
  946.     End With
  947. End Function
  948. Private Sub chkEnvelope_Click()
  949.     Call ChangeParameter("envelope")                    'Call the sub to change the parameters for the envelope of the effect.
  950.             
  951. End Sub
  952. Private Sub Form_Load()
  953.     Dim intCount As Integer                             'Count variable
  954.         
  955.     Set di = dx.DirectInputCreate                       'Create the direct input device
  956.     Set enumDevice = di.GetDIEnumDevices(DIDEVTYPE_JOYSTICK, DIEDFL_ATTACHEDONLY Or DIEDFL_FORCEFEEDBACK)
  957.                                                         'Enumerate all joysticks that are attached to the system
  958.     If enumDevice.GetCount > 0 Then                     'If the count is above 0, there is a force feedback joystick attached
  959.         Set diJoystick = di.CreateDevice(enumDevice.GetItem(1).GetGuidInstance)
  960.                                                         'Get the GUID for the joystick
  961.         diJoystick.SetCommonDataFormat DIFORMAT_JOYSTICK
  962.                                                         'Set the format of the device to that of a joystick
  963.         diJoystick.SetCooperativeLevel Me.hWnd, DISCL_BACKGROUND Or DISCL_EXCLUSIVE
  964.                                                         'Set the cooperative level of the device as an exclusive
  965.                                                         'background device, and attach it to the form's hwnd
  966.         diJoystick.GetCapabilities Caps                 'Get the capabilites of the device
  967.         Set diEnumObjects = diJoystick.GetDeviceObjectsEnum(DIDFT_FFEFFECTTRIGGER Or DIDFT_BUTTON)
  968.                                                     'Grab all the objects on the device, as long as it can be used
  969.                                                     'as a force feedback trigger, and it is a button
  970.                     
  971.         ReDim Button(diEnumObjects.GetCount)        'Redimension the array to the number of buttons found
  972.         For intCount = 1 To diEnumObjects.GetCount  'Loop through all the objects
  973.             Set diDevObjInstance = diEnumObjects.GetItem(intCount)
  974.                                                     'Get this item, and create it as a device object instance
  975.             Button(intCount) = diDevObjInstance.GetOfs
  976.                                                     'Store the offset of this object in the button array
  977.         Next intCount
  978.         
  979.         'turn off autocenter
  980.         Dim prop As DIPROPLONG
  981.         prop.lData = 0
  982.         prop.lHow = DIPH_DEVICE
  983.         prop.lObj = 0
  984.         prop.lSize = Len(prop)
  985.         Call diJoystick.SetProperty("DIPROP_AUTOCENTER", prop)
  986.          
  987.         
  988.         diJoystick.Acquire                          'Make sure to aquire the device
  989.         Set diEffEnum = diJoystick.GetEffectsEnum(DIEFT_ALL)
  990.                                                     'Enumerate all the available effects
  991.         For intCount = 1 To diEffEnum.GetCount      'Loop through all the effects
  992.             diEffectType = diEffEnum.GetType(intCount) And &HFF
  993.                                                     'Filter out the major type of effect it is
  994.             diFFStaticParams = diEffEnum.GetStaticParams(intCount)
  995.                                                     'Get the static parameters of this effect
  996.             If (diEffectType = DIEFT_HARDWARE) And _
  997.             (diFFStaticParams And DIEP_TYPESPECIFICPARAMS) <> 0 Then
  998.                                                     'If this is a hardware effect that has type-specific parameters,
  999.                 GoTo Ignore                         'ignore it and skip to the next effect
  1000.             ElseIf diEffectType = DIEFT_CUSTOMFORCE Then
  1001.                                                     'If this effect is a custom effect,
  1002.                 GoTo Ignore                         'ignore it and skip to the next effect
  1003.             End If
  1004.             lstEffects.AddItem diEffEnum.GetName(intCount)
  1005.                                                     'Add this effect to the listbox, displaying the name of the
  1006.                                                     'effect
  1007.             ReDim Preserve EffectParams(lstEffects.ListCount - 1)
  1008.                                                     'Redimension the array that stores the type of effect this
  1009.                                                     'effect is
  1010.             EffectParams(lstEffects.ListCount - 1) = diEffectType
  1011.                                                     'store the type of effect in the EffectParams array
  1012.             ReDim Preserve diFFEffect(lstEffects.ListCount - 1)
  1013.                                                     'Redimension the effect object array
  1014.             
  1015.             On Local Error GoTo ErrorHandler        'Catch any errors when creating the effect object
  1016.             Set diFFEffect(UBound(diFFEffect)) = diJoystick.CreateEffect(diEffEnum.GetEffectGuid(intCount), _
  1017.             CreateFFEffect(intCount))               'Create the effect, using the return value from the
  1018.                                                     'CreateFFEffect function, which returns a generic effect
  1019.                                                     'structure
  1020.             diFFEffect(UBound(diFFEffect)).Unload   'Since creating an effect automtically downloads it, unload
  1021.                                                     'it so we don't run out of room on the device.
  1022.                                                     
  1023.                                                     
  1024.             
  1025. Ignore:
  1026.         Next
  1027.     Else                                                'If no joystick is found attached to the system
  1028.         MsgBox "No force feedback joystick attached"    'Display this message
  1029.         Unload Me                                       'Unload the form
  1030.         End                                             'End the program
  1031.     End If
  1032.     lngLastEffectIndex = UBound(diFFEffect)             'Store the ubound of the effect array as the last effect accessed
  1033.     lstEffects.ListIndex = 0                            'make the first index of the listbox selected
  1034.     Exit Sub                                            'Exit the sub
  1035. ErrorHandler:                                           'Handle any errors that occur when trying to create an effect object
  1036.     If Err.Number = 5 Then                              'If this is an effect that isn't able to be loaded
  1037.         lstEffects.RemoveItem lstEffects.ListCount - 1  'Remove the item from the list
  1038.         ReDim Preserve diFFEffect(lstEffects.ListCount - 1)
  1039.                                                         'Redimension the array since this effect will not be included
  1040.         Resume Next                                     'Continue program execution on the next line
  1041.     ElseIf Err.Number = DIERR_NOTEXCLUSIVEACQUIRED Then 'If the program loses exclusive use of the joystick,
  1042.         diJoystick.Unacquire                            'Unacquire the joystick
  1043.         diJoystick.SetCooperativeLevel Me.hWnd, DISCL_BACKGROUND Or DISCL_EXCLUSIVE
  1044.                                                         'Set the cooperative level again
  1045.         diJoystick.Acquire                              'Acquire the joystick again
  1046.         Resume                                          'Resume execution on that line again, since the program
  1047.                                                         'now has control of the joystick
  1048.     End If
  1049. End Sub
  1050. Private Sub lstEffects_Click()
  1051.     'This sub unloads the last effect, downloads the new one, stores the index in the last effect variable, and
  1052.     'calls the sub to update all the frames and controls on the form
  1053.     Dim EffectInfo As DIEFFECT                          'Dim a DIEFFECT structure
  1054.     On Local Error GoTo ErrorHandler                    'Catch any errors while unloading/downloading effects
  1055.     diFFEffect(lngLastEffectIndex).Unload               'Unload the last effect
  1056.     diFFEffect(lstEffects.ListIndex).Download           'Download the new one
  1057.     lngLastEffectIndex = lstEffects.ListIndex           'Store this list index in the lasteffectindex variable
  1058.     Call UpdateFrames                                   'Call the sub that updates all the frames and the controls
  1059.                                                         'they contain on the form
  1060.     Exit Sub
  1061. ErrorHandler:                                           'Handle any errors
  1062.     If Err.Number = DIERR_NOTEXCLUSIVEACQUIRED Then     'If the program loses exclusive use of the joystick,
  1063.         diJoystick.Unacquire                            'Unacquire the joystick
  1064.         diJoystick.SetCooperativeLevel Me.hWnd, DISCL_BACKGROUND Or DISCL_EXCLUSIVE
  1065.                                                         'Set the cooperative level again
  1066.         diJoystick.Acquire                              'Acquire the joystick again
  1067.         Resume                                          'Resume execution on that line again, since the program
  1068.                                                         'now has control of the joystick
  1069.     End If
  1070. End Sub
  1071. Private Sub ChangeParameter(Param As String)
  1072.     'This sub changes the specified parameter
  1073.     Dim EffectInfo As DIEFFECT                          'Dim a DIEFFECT structure
  1074.     diFFEffect(lstEffects.ListIndex).GetParameters EffectInfo
  1075.                                                         'Get the parameters of this effect
  1076.     On Local Error GoTo ErrorHandler                    'If there are any errors that occur, trap them
  1077.         
  1078.     Select Case Param                                   'Select the string value passed to the sub
  1079.         Case "duration"                                 'If duration is being changed
  1080.             If sldDuration = 50001 Then                 'If the slider's value is at 50,001
  1081.                 EffectInfo.lDuration = -1               'Then make the effect have an infinite duration
  1082.             Else                                        'Otherwise
  1083.                 EffectInfo.lDuration = sldDuration * 100
  1084.                                                         'Multiply the slider's value by 100 to convert to microseconds
  1085.             End If
  1086.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_DURATION
  1087.                                                         'Set the new parameter, specifiying the duration is what needs
  1088.                                                         'to be changed
  1089.         Case "gain"                                     'If gain is the parameter to be changed,
  1090.             EffectInfo.lGain = sldGain                  'Set the effect info element lGain to the value of the gain slider
  1091.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_GAIN
  1092.                                                         'Set the new gain
  1093.         Case "samplerate"                               'The sample rate is the parameter to be changed
  1094.             EffectInfo.lSamplePeriod = sldSamplePeriod  'Set the effectinfo lSamplePeriod to the value of the sample period slider
  1095.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_SAMPLEPERIOD
  1096.                                                         'Set the parameter
  1097.         Case "constantforcemagnitude"                   'If the constant force magnitude is to be changed
  1098.             EffectInfo.constantForce.lMagnitude = sldConstantForce
  1099.                                                         'Set the constant force element to the value of the constant
  1100.                                                         'force slider
  1101.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_TYPESPECIFICPARAMS
  1102.                                                         'Change the parameter
  1103.         Case "rampforce"                                'If ramp force is the parameter to change
  1104.             EffectInfo.rampForce.lRangeStart = sldRampRange(0).Value
  1105.                                                         'Set the start range to the range slider(0) value
  1106.             EffectInfo.rampForce.lRangeEnd = sldRampRange(1).Value
  1107.                                                         'Set the end range to the range slider(1) value
  1108.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_TYPESPECIFICPARAMS
  1109.                                                         'Set the parameters
  1110.         Case "periodic"                                 'If a periodic effect parameter needs to be changed
  1111.             With EffectInfo.periodicForce
  1112.                 .lMagnitude = sldPeriodic(0)            'set the magnitude
  1113.                 .lOffset = sldPeriodic(1)               'the offset
  1114.                 .lPhase = sldPeriodic(2)                'the phase (this is almost always going to fail, there aren't
  1115.                                                         'a lot of drivers that will support this)
  1116.                 .lPeriod = sldPeriodic(3)               'the period of the effect
  1117.             End With
  1118.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_TYPESPECIFICPARAMS
  1119.                                                         'set the parameters
  1120.         Case "condition"                                'If it is a conditional effect parameter
  1121.             If optConditionAxis(0) Then                 'If the X axis is selected
  1122.                 With EffectInfo.conditionX              'Update the X axis condition information
  1123.                     .lDeadBand = sldCondition(0)        'set the deadband
  1124.                     .lNegativeCoefficient = sldCondition(1)
  1125.                                                         'set the negative coefficient
  1126.                     .lNegativeSaturation = sldCondition(2)
  1127.                                                         'set the negative saturation
  1128.                     .lOffset = sldCondition(3)          'set the offset
  1129.                     .lPositiveCoefficient = sldCondition(4)
  1130.                                                         'set the positive coefficient
  1131.                     .lPositiveSaturation = sldCondition(5)
  1132.                                                         'set the positive saturation
  1133.                 End With
  1134.             Else                                        'Otherwise, the Y axis is being set
  1135.                 With EffectInfo.conditionY
  1136.                     .lDeadBand = sldCondition(0)        'set the deadband
  1137.                     .lNegativeCoefficient = sldCondition(1)
  1138.                                                         'set the negative coefficient
  1139.                     .lNegativeSaturation = sldCondition(2)
  1140.                                                         'set the negative saturation
  1141.                     .lOffset = sldCondition(3)          'set the offset
  1142.                     .lPositiveCoefficient = sldCondition(4)
  1143.                                                         'set the positive coefficient
  1144.                     .lPositiveSaturation = sldCondition(5)
  1145.                                                         'set the positive saturation
  1146.                 End With
  1147.             End If
  1148.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_TYPESPECIFICPARAMS
  1149.                                                         'set the parameters
  1150.         Case "envelope"                                 'the envelope needs to be changed
  1151.             If chkEnvelope.Value = 1 Then               'if the envelope checkbox is checked
  1152.                 With EffectInfo
  1153.                     .bUseEnvelope = True                'let DirectInput know this effect has an envelope
  1154.                     With .envelope
  1155.                         .lAttackLevel = sldEnvelope(0)  'set the attack level
  1156.                         .lAttackTime = sldEnvelope(1)   'set the attack time
  1157.                         .lFadeLevel = sldEnvelope(2)    'set the fade level
  1158.                         .lFadeTime = sldEnvelope(3)     'set the fade time
  1159.                     End With
  1160.                 End With
  1161.                 diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_ENVELOPE
  1162.                                                         'Set the new parameters
  1163.             Else
  1164.                 EffectInfo.bUseEnvelope = False         'Otherwise, let DirectInput know that this effect doesn't use an envelope
  1165.                 diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_ENVELOPE
  1166.                                                         'Set the parameters to reflect this change
  1167.             End If
  1168.         Case "direction"                                'Direction is the parameter that needs to be changed
  1169.             With EffectInfo
  1170.                 If optDirection(0) Then                 'If the north button is selected
  1171.                     .x = 0                              'set the effect's direction to come from the north
  1172.                 ElseIf optDirection(1) Then             'If the north-east button is selected
  1173.                     .x = 4500                           'set the effect's direction to come from the north-east
  1174.                 ElseIf optDirection(2) Then             'if the east button is selected
  1175.                     .x = 9000                           'set the effect's direction to come from the east
  1176.                 ElseIf optDirection(3) Then             'if the south-east button is selected
  1177.                     .x = 13500                          'set the effect's direction to come from the south east
  1178.                 ElseIf optDirection(4) Then             'if the south button is selected
  1179.                     .x = 18000                          'set the effect's direction to come from the south
  1180.                 ElseIf optDirection(5) Then             'if the south-west button is selected
  1181.                     .x = 22500                          'set the effect's direction to come from the south-west
  1182.                 ElseIf optDirection(6) Then             'if the west button is selected
  1183.                     .x = 27000                          'set the effect's direction to come from the west
  1184.                 ElseIf optDirection(7) Then             'if the north-west button is selected
  1185.                     .x = 31500                          'set the effects's direction to come from the north-west
  1186.                 End If
  1187.             End With
  1188.             diFFEffect(lstEffects.ListIndex).SetParameters EffectInfo, DIEP_DIRECTION
  1189.                                                         'set the parameters
  1190.     End Select
  1191.         
  1192.     Exit Sub
  1193. ErrorHandler:                                           'if an error is encountered while setting a parameter
  1194.     If Err.Number = 445 Then                            'If the object doesn't support this action then
  1195.         MsgBox "The parameter cannot be set to this value for this effect type"
  1196.                                                         'display this message
  1197.     ElseIf Err.Number = DIERR_NOTEXCLUSIVEACQUIRED Then 'If the program loses exclusive use of the joystick,
  1198.         diJoystick.Unacquire                            'Unacquire the joystick
  1199.         diJoystick.SetCooperativeLevel Me.hWnd, DISCL_BACKGROUND Or DISCL_EXCLUSIVE
  1200.                                                         'Set the cooperative level again
  1201.         diJoystick.Acquire                              'Acquire the joystick again
  1202.         Resume                                          'Resume execution on that line again, since the program
  1203.                                                         'now has control of the joystick
  1204.     End If
  1205. End Sub
  1206. Private Sub UpdateFrames()
  1207.     'This sub updates all the frames and controls the frame contains on the form, with the values in the
  1208.     'currently selected effect
  1209.     Dim EffType As DIEFFECT                             'dim a DIEFFECT structure
  1210.         
  1211.     frameConstantForce.Visible = False                  '
  1212.     frameRampForce.Visible = False                      'Hide all type-specific frames
  1213.     framePeriodic.Visible = False                       '
  1214.     frameCondition.Visible = False                      '
  1215.     diFFEffect(lstEffects.ListIndex).GetParameters EffType
  1216.                                                         'get the parameters of the effect
  1217.     optDirection(EffType.x \ 4500).Value = True           'make sure the correct direction is displayed
  1218.     If EffType.bUseEnvelope = True Then                 'if this effect is using an envelope
  1219.         chkEnvelope.Value = 1                           'make sure the envelope checkbox is checked
  1220.         sldEnvelope(0).Value = EffType.envelope.lAttackLevel
  1221.                                                         'display the attack level
  1222.         sldEnvelope(1).Value = EffType.envelope.lAttackTime
  1223.                                                         'display the attack time
  1224.         sldEnvelope(2).Value = EffType.envelope.lFadeLevel
  1225.                                                         'display the fade level
  1226.         sldEnvelope(3).Value = EffType.envelope.lFadeTime
  1227.                                                         'display the fade time
  1228.     Else                                                'otherwise
  1229.         chkEnvelope.Value = 0                           '
  1230.         sldEnvelope(0).Value = 0                        'Zero everything out
  1231.         sldEnvelope(1).Value = 0                        '
  1232.         sldEnvelope(2).Value = 0                        '
  1233.         sldEnvelope(3).Value = 0                        '
  1234.     End If
  1235.     If EffType.lDuration = -1 Then                      'If the effect duration is infinite
  1236.         sldDuration = 50001                             'make sure the slider reflects this
  1237.     Else                                                'otherwise
  1238.         sldDuration = EffType.lDuration \ 100           'set the slider to the milliseconds
  1239.     End If
  1240.     sldGain = EffType.lGain                             'display the gain
  1241.     sldSamplePeriod = EffType.lSamplePeriod             'display the sample period
  1242.     sldConstantForce = EffType.constantForce.lMagnitude 'display the constant force magnitude
  1243.     sldRampRange(0) = EffType.rampForce.lRangeStart     'display the range start of the ramp force
  1244.     sldRampRange(1) = EffType.rampForce.lRangeEnd       'display the range end of the ramp force
  1245.     sldPeriodic(0) = EffType.periodicForce.lMagnitude   'display the magnitude of the periodic force
  1246.     sldPeriodic(1) = EffType.periodicForce.lOffset      'display the offset of the periodic force
  1247.     sldPeriodic(2) = EffType.periodicForce.lPhase       'display the phase of the periodic force
  1248.     sldPeriodic(3) = EffType.periodicForce.lPeriod      'display the period of the periodic force
  1249.     If optConditionAxis(0) Then                         'if the X axis option button is selected
  1250.         sldCondition(0) = EffType.conditionX.lDeadBand  'display the deadband value
  1251.         sldCondition(1) = EffType.conditionX.lNegativeCoefficient
  1252.                                                         'display the neg. coefficient
  1253.         sldCondition(2) = EffType.conditionX.lNegativeSaturation
  1254.                                                         'display the neg. saturation
  1255.         sldCondition(3) = EffType.conditionX.lOffset    'display the offset
  1256.         sldCondition(4) = EffType.conditionX.lPositiveCoefficient
  1257.                                                         'display the pos. coefficient
  1258.         sldCondition(5) = EffType.conditionX.lPositiveSaturation
  1259.                                                         'display the pos. saturation
  1260.     Else                                                'otherwise, display all the info for the Y axis
  1261.         sldCondition(0) = EffType.conditionY.lDeadBand  'display the deadband value
  1262.         sldCondition(1) = EffType.conditionY.lNegativeCoefficient
  1263.                                                         'display the neg. coefficient
  1264.         sldCondition(2) = EffType.conditionY.lNegativeSaturation
  1265.                                                         'display the neg. saturation
  1266.         sldCondition(3) = EffType.conditionY.lOffset    'display the offset
  1267.         sldCondition(4) = EffType.conditionY.lPositiveCoefficient
  1268.                                                         'display the pos. coefficient
  1269.         sldCondition(5) = EffType.conditionY.lPositiveSaturation
  1270.                                                         'display the pos. saturation
  1271.     End If
  1272.     Select Case EffectParams(lstEffects.ListIndex)
  1273.                                                         'Get the effect type of this effect from the type stored in
  1274.                                                         'the array.
  1275.         Case DIEFT_CONSTANTFORCE                        'If this is a constant force effect
  1276.             frameConstantForce.Visible = True           'display the constant force frame
  1277.         Case DIEFT_RAMPFORCE                            'If this is a ramp force effect
  1278.             frameRampForce.Visible = True               'Show the ramp force frame
  1279.         Case DIEFT_PERIODIC                             'If this is a square force
  1280.             framePeriodic.Visible = True                'show the periodic effect frame
  1281.         Case DIEFT_CONDITION                              'if this is a spring effect
  1282.             frameCondition.Visible = True               'show the condition frame
  1283.         Case Else                                       'this effect is a hardware effect with no type-specific parameters
  1284.     End Select
  1285. End Sub
  1286. Private Sub optConditionAxis_Click(Index As Integer)
  1287.     Call UpdateFrames                                   'Update the frames
  1288. End Sub
  1289. Private Sub optDirection_Click(Index As Integer)
  1290.     Call ChangeParameter("direction")                   'Change the direction parameter
  1291. End Sub
  1292. Private Sub sldCondition_Change(Index As Integer)
  1293.     lblCondition(Index) = sldCondition(Index)           'display the value in the label
  1294.     Call ChangeParameter("condition")                   'change the condition parameter
  1295. End Sub
  1296. Private Sub sldConstantForce_Change()
  1297.     lblConstantForce = sldConstantForce                 'display the value
  1298.     Call ChangeParameter("constantforcemagnitude")      'change the parameter
  1299. End Sub
  1300. Private Sub sldDuration_Change()
  1301.     lblDuration = sldDuration \ 10 & " Milliseconds"    'show the value in milliseconds
  1302.     If sldDuration = 50001 Then lblDuration = "Infinite"
  1303.                                                         'if the value is 50,001 make sure that infinite is displayed
  1304.     Call ChangeParameter("duration")                    'change the duration parameter
  1305. End Sub
  1306. Private Sub sldEnvelope_Change(Index As Integer)
  1307.     lblEnvelope(Index) = sldEnvelope(Index) \ 1000      'show the value in milliseconds
  1308.     If chkEnvelope.Value = 1 Then                       'if the envelope check box is checked
  1309.         Call ChangeParameter("envelope")                'change the envelope parameter
  1310.     End If
  1311. End Sub
  1312. Private Sub sldGain_Change()
  1313.     lblGain = sldGain                                   'show the value
  1314.     Call ChangeParameter("gain")                        'change the parameter
  1315. End Sub
  1316. Private Sub sldPeriodic_Change(Index As Integer)
  1317.     lblPeriodic(Index) = sldPeriodic(Index)             'show the value
  1318.     Call ChangeParameter("periodic")                    'change the parameter
  1319.                 
  1320. End Sub
  1321. Private Sub sldrampRange_Change(Index As Integer)
  1322.     lblRange(Index) = sldRampRange(Index).Value         'show the value
  1323.     Call ChangeParameter("rampforce")                   'change the parameter
  1324. End Sub
  1325. Private Sub sldSamplePeriod_Change()
  1326.     If sldSamplePeriod = 0 Then                         'if the sample period is 0,
  1327.         lblSamplePeriod = "Default"                     'display that it is the default
  1328.     Else                                                'otherwise
  1329.         lblSamplePeriod = sldSamplePeriod               'display the sample period
  1330.     End If
  1331.     Call ChangeParameter("samplerate")                  'change the parameter
  1332. End Sub
  1333.