home *** CD-ROM | disk | FTP | other *** search
/ PC-Test Pro / PCTESTPRO.iso / clocks / attall / entp / atomic.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-12-29  |  20.3 KB  |  586 lines

  1. VERSION 2.00
  2. Begin Form Atomic 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Call the Atomic Clock"
  6.    ClientHeight    =   4665
  7.    ClientLeft      =   2475
  8.    ClientTop       =   945
  9.    ClientWidth     =   4695
  10.    ClipControls    =   0   'False
  11.    Height          =   5100
  12.    Left            =   2400
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   4665
  17.    ScaleWidth      =   4695
  18.    Top             =   585
  19.    Width           =   4845
  20.    Begin TextBox InitString 
  21.       BackColor       =   &H00FFFFFF&
  22.       Height          =   300
  23.       Left            =   390
  24.       TabIndex        =   6
  25.       Text            =   "ATZ"
  26.       Top             =   1710
  27.       Width           =   4080
  28.    End
  29.    Begin MSComm Comm1 
  30.       InBufferSize    =   2048
  31.       Interval        =   1000
  32.       Left            =   3390
  33.       NullDiscard     =   -1  'True
  34.       OutBufferSize   =   2048
  35.       RTSEnable       =   -1  'True
  36.       Top             =   1125
  37.    End
  38.    Begin SSCheck DST 
  39.       Caption         =   "Use Daylight Savings Time"
  40.       Height          =   285
  41.       Left            =   225
  42.       TabIndex        =   4
  43.       Top             =   960
  44.       Width           =   2640
  45.    End
  46.    Begin ComboBox TimeZone 
  47.       BackColor       =   &H00FFFFFF&
  48.       Height          =   300
  49.       Left            =   375
  50.       Style           =   2  'Dropdown List
  51.       TabIndex        =   3
  52.       Top             =   450
  53.       Width           =   4065
  54.    End
  55.    Begin CommandButton Command1 
  56.       Cancel          =   -1  'True
  57.       Caption         =   "Cancel"
  58.       Height          =   345
  59.       Index           =   2
  60.       Left            =   2370
  61.       TabIndex        =   1
  62.       Top             =   4020
  63.       Width           =   2085
  64.    End
  65.    Begin CommandButton Command1 
  66.       Caption         =   "Dial"
  67.       Default         =   -1  'True
  68.       Height          =   345
  69.       Index           =   1
  70.       Left            =   2370
  71.       TabIndex        =   0
  72.       Top             =   3510
  73.       Width           =   2070
  74.    End
  75.    Begin CommandButton Command1 
  76.       Caption         =   "Reset Defaults"
  77.       Height          =   345
  78.       Index           =   0
  79.       Left            =   2370
  80.       TabIndex        =   14
  81.       Top             =   3000
  82.       Width           =   2070
  83.    End
  84.    Begin SSFrame Frame3D1 
  85.       Caption         =   "COM Port"
  86.       ForeColor       =   &H00000000&
  87.       Height          =   1530
  88.       Left            =   255
  89.       TabIndex        =   9
  90.       Top             =   2910
  91.       Width           =   1965
  92.       Begin SSOption ComPort 
  93.          Caption         =   "COM&4:"
  94.          ForeColor       =   &H00000000&
  95.          Height          =   240
  96.          Index           =   3
  97.          Left            =   135
  98.          TabIndex        =   13
  99.          Top             =   1185
  100.          Width           =   780
  101.       End
  102.       Begin SSOption ComPort 
  103.          Caption         =   "COM&3:"
  104.          ForeColor       =   &H00000000&
  105.          Height          =   240
  106.          Index           =   2
  107.          Left            =   135
  108.          TabIndex        =   12
  109.          Top             =   885
  110.          Width           =   780
  111.       End
  112.       Begin SSOption ComPort 
  113.          Caption         =   "COM&2:"
  114.          ForeColor       =   &H00000000&
  115.          Height          =   240
  116.          Index           =   1
  117.          Left            =   135
  118.          TabIndex        =   11
  119.          Top             =   585
  120.          Width           =   780
  121.       End
  122.       Begin SSOption ComPort 
  123.          Caption         =   "COM&1:"
  124.          ForeColor       =   &H00000000&
  125.          Height          =   240
  126.          Index           =   0
  127.          Left            =   135
  128.          TabIndex        =   10
  129.          Top             =   285
  130.          Width           =   780
  131.       End
  132.    End
  133.    Begin TextBox DialString 
  134.       BackColor       =   &H00FFFFFF&
  135.       Height          =   300
  136.       Left            =   375
  137.       TabIndex        =   8
  138.       Text            =   "ATDT 1 303 494-4774"
  139.       Top             =   2430
  140.       Width           =   4080
  141.    End
  142.    Begin Label Label1 
  143.       BackStyle       =   0  'Transparent
  144.       Caption         =   "Modem Initialization String"
  145.       Height          =   210
  146.       Index           =   2
  147.       Left            =   240
  148.       TabIndex        =   5
  149.       Top             =   1440
  150.       Width           =   2415
  151.    End
  152.    Begin Label Status 
  153.       Alignment       =   1  'Right Justify
  154.       BackStyle       =   0  'Transparent
  155.       Height          =   240
  156.       Left            =   1125
  157.       TabIndex        =   15
  158.       Top             =   15
  159.       Width           =   3300
  160.    End
  161.    Begin Label Label1 
  162.       BackStyle       =   0  'Transparent
  163.       Caption         =   "Modem Dial String"
  164.       Height          =   210
  165.       Index           =   1
  166.       Left            =   225
  167.       TabIndex        =   7
  168.       Top             =   2160
  169.       Width           =   2145
  170.    End
  171.    Begin Label Label1 
  172.       BackStyle       =   0  'Transparent
  173.       Caption         =   "Time Zone"
  174.       Height          =   240
  175.       Index           =   0
  176.       Left            =   195
  177.       TabIndex        =   2
  178.       Top             =   165
  179.       Width           =   1320
  180.    End
  181. Option Explicit
  182. Dim ControlsDisabled As Integer
  183. Dim Instring As String
  184. Dim TString As String
  185. Dim Aborted As Integer
  186.                              'DESCRIPTION OF THE
  187.                  'AUTOMATED COMPUTER TELEPHONE SERVICE (ACTS)
  188. 'The following is transmitted (at 1200 Baud) after completion of the
  189. 'telephone connection.
  190.              '? = HELP
  191.              'National Institute of Standards and Technology
  192.              'Telephone Time Service
  193.                                      'D  L D
  194.               'MJD  YR MO DA H  M  S  ST S UT1 msADV        <OTM>
  195.              '47999 90-04-18 21:39:15 50 0 +.1 045.0 UTC(NIST) *
  196.              '47999 90-04-18 21:39:16 50 0 +.1 045.0 UTC(NIST) *
  197.              '47999 90-04-18 21:39:17 50 0 +.1 045.0 UTC(NIST) *
  198.              '47999 90-04-18 21:39:18 50 0 +.1 045.0 UTC(NIST) *
  199.              '47999 90-04-18 21:39:19 50 0 +.1 037.6 UTC(NIST) #
  200.              '47999 90-04-18 21:39:20 50 0 +.1 037.6 UTC(NIST) #
  201.              'etc..etc...etc.......
  202. 'UTC = Universal Time Coordinated, the official world time referred to the
  203. 'zero meridian.
  204. '_________________________________________________________________________
  205. 'DST = Daylight savings time characters, valid for the continental U.S., are
  206. 'set as follows:
  207.   '00 = We are on standard time (ST).    50 = We are on DST.
  208.   '99 to 51 = Now on ST, go to DST when your local time is 2:00 am and the
  209.     'count is 51.  The count is decremented daily at 00 (UTC).
  210.   '49 to 01 = Now on DST, go to ST when your local time is 2:00 am and the
  211.     'count is 01.  The count is decremented daily at 00 (UTC).
  212. 'The two DST characters provide up to 48 days advance notice of a change in
  213. 'time.  The count remains at 00 or 50 at other times.
  214. '_________________________________________________________________________
  215. 'LS = Leap second flag is set to "1" to indicate that a leap second is to be
  216. 'added as 23:59:60 (UTC) on the last day of the current UTC month.  The LS
  217. 'flag will be reset to "0" starting with 23:59:60 (UTC).  The flag will
  218. 'remain on for the entire month before the second is added.  Leap seconds
  219. 'are added as needed at the end of any month.  Usually June and/or December
  220. 'are chosen.
  221. '__________________________________________________________________________
  222. 'DUT1 = Approximate difference between earth rotation time (UT1) and UTC, in
  223. 'steps of 0.1 second.         DUT1 = UT1 - UTC
  224. '___________________________________________________________________________
  225. 'MJD = Modified Julian Date, often used to tag certain scientific data.
  226. '___________________________________________________________________________
  227. 'The full time format is sent at 1200 Baud, 8 bit, 1 stop, no parity.
  228. 'The format at 300 Baud is also 8 bit, 1 stop, no parity.
  229. 'At 300 Baud the MJD and DUT1 values are deleted and the
  230. 'time is transmitted only on even seconds.
  231. '___________________________________________________________________________
  232. 'Maximum on line time will be 56 seconds.  If all lines are busy at any time,
  233. 'the oldest call will be terminated if it has been on line more than 28
  234. 'seconds, else, the call that first reaches 28 seconds will be terminated.
  235. '___________________________________________________________________________
  236. 'Current time is valid at the "on-time" marker (OTM), either "*" or "#".
  237. 'The nominal on-time marker (*) will be transmitted 45 ms early to account
  238. 'for the 8 ms required to send 1 character at 1200 Baud, plus an additional
  239. '7 ms for delay from NIST to the user, and approximately 30 ms "scrambler"
  240. 'delay inherent in 1200 Baud modems.  If the caller echoes all characters,
  241. 'NIST will measure the round trip delay and advance the on-time marker so
  242. 'that the midpoint of the stop bit arrives at the user on time.  The amount
  243. 'of msADV will reflect the actual required advance in milliseconds and the
  244. 'OTM will be a "#".  The NIST system requires 4 or 5 consecutive delay
  245. 'measurements which are consistent before switching from "*" to "#".
  246. 'If the user has a 1200 Baud modem with the same internal delay as that used
  247. 'by NIST, then the "#" OTM should arrive at the user within +-2 ms of the
  248. 'correct time.  However, NIST has studied different brands of 1200 Baud
  249. 'modems and found internal delays from 24 ms to 40 ms and offsets of the
  250. '"#" OTM of +-10 ms.  For many computer users, +-10 ms accuracy should be
  251. 'more than adequate since many computer internal clocks can only be set with
  252. 'granularity of 20 to 50 ms.  In any case, the repeatability of the offset
  253. 'for the "#" OTM should be within +-2 ms, if the dial-up path is reciprocal
  254. 'and the user doesn't change the brand or model of modem used. This should
  255. 'be true even if the dial-up path on one day is a land-line of less than
  256. '40 ms (one way) and on the next day is a satellite link of 260 to 300 ms.
  257. 'In the rare event that the path is one way by satellite and the other way
  258. 'by land line with a round trip measurement in the range of 90 to 260 ms,
  259. 'the OTM will remain a "*" indicating 45 ms advance.
  260. '___________________________________________________________________________
  261. 'For user comments write:
  262. 'NIST-ACTS
  263. 'Time and Frequency Division
  264. 'Mail Stop 524
  265. '325 Broadway
  266. 'Boulder, CO  80303
  267. 'Software for setting (PC)DOS compatable machines is available
  268. 'on a 360-kbyte diskette for $35.00 from:
  269. 'NIST Office of Standard Reference Materials
  270. 'B311-Chemistry Bldg, NIST, Gaithersburg, MD, 20899, (301) 975-6776
  271. '--------------------------------------------------------------------------
  272. Sub Command1_Click (Index As Integer)
  273. Dim StartTime As Double
  274. Dim I As Integer
  275. Dim NewD As Double
  276. Dim OldD As Double
  277. Dim DSTFlag As String
  278. Dim OffBy As String
  279. Dim Cmd$, CommLen%
  280. Dim T$
  281. If Index = 0 Then  'Reset Defaults
  282.    ResetDefaults
  283.    Status.Caption = ""
  284. End If
  285. If Index = 1 Then  'Dial
  286.    SaveModemSettings
  287.    Aborted = False
  288.    Status.Caption = ""
  289.    Command1(0).Enabled = False
  290.    Command1(1).Enabled = False
  291.    TimeZone.Enabled = False
  292.    DST.Enabled = False
  293.    DialString.Enabled = False
  294.    InitString.Enabled = False
  295.    Frame3D1.Enabled = False
  296.    ControlsDisabled = True
  297.    On Local Error GoTo ErrHndl
  298.    For I% = 0 To 3
  299.      If ComPort(I%).Value Then Comm1.CommPort = I% + 1
  300.    Next I%
  301.    If Aborted Then Exit Sub
  302.    Comm1.Settings = "1200,N,8,1"
  303.    If Aborted Then Exit Sub
  304.    Comm1.PortOpen = True
  305.    If Aborted Then Exit Sub
  306. 'Debug.Print comm1.InBufferCount
  307.    Cmd$ = InitString.Text + Chr$(13) + Chr(10)
  308.    CommLen% = Len(Cmd$)
  309.    Comm1.Output = Cmd$
  310. 'Debug.Print comm1.InBufferCount
  311.    StartTime = Timer
  312.    LastTime = 0
  313.    Do
  314.       DoEvents
  315.       If LastTime <> Int(Timer) Then
  316.          If Not Aborted Then Status.Caption = "Initial - " + Format$(10 - Int(Timer - StartTime)) + " seconds until timeout."
  317.          LastTime = Int(Timer)
  318.       End If
  319.    Loop Until Comm1.InBufferCount > CommLen% + 5 Or ((Timer - StartTime) > 10) Or Aborted
  320.    If Aborted Then Exit Sub
  321.    Instring$ = Comm1.Input
  322.    If Instring$ = "" Then
  323.       Status.Caption = ""
  324.       MsgBox "No response from modem."
  325.       EnableControls
  326.       Exit Sub
  327.    End If
  328.    'Debug.Print ">"; instring$; "<"
  329.    DoEvents
  330.    While Comm1.InBufferCount > 0
  331.    DoEvents
  332.    DoEvents
  333.    DoEvents
  334.    DoEvents
  335.    DoEvents
  336.    DoEvents
  337.    Instring$ = Comm1.Input
  338.    'Debug.Print ">"; instring$; "<"
  339.    Wend
  340.    StartTime = Timer
  341.    LastTime = 0
  342. While (Timer - StartTime) < 3
  343. DoEvents
  344.       If LastTime <> Int(Timer) Then
  345.          If Not Aborted Then Status.Caption = "Waiting - " + Format$(3 - Int(Timer - StartTime)) + " seconds."
  346.          LastTime = Int(Timer)
  347.       End If
  348.    If Aborted Then Exit Sub
  349.    Instring$ = Comm1.Input
  350.    'Debug.Print ">"; instring$; "<"
  351.    Comm1.Output = DialString.Text + Chr$(13) + Chr(10)
  352.    StartTime = Timer
  353.    LastTime = 0
  354.    Do
  355.       DoEvents
  356.       If LastTime <> Int(Timer) Then
  357.          If Not Aborted Then
  358.              T$ = "Connecting - "
  359.              If Comm1.InBufferCount > 50 Then T$ = "Connected - "
  360.              Status.Caption = T$ + Format$(75 - Int(Timer - StartTime)) + " seconds until timeout."
  361.          End If
  362.          LastTime = Int(Timer)
  363.       End If
  364.    Loop Until (Comm1.InBufferCount >= 500) Or ((Timer - StartTime) > 75) Or Aborted
  365.    If Aborted Then Exit Sub
  366.    If (Timer - StartTime) > 75 Then
  367.          Status.Caption = "Timed out."
  368.          Exit Sub
  369.    End If
  370.    Status.Caption = "Setting time."
  371.    DoEvents
  372.    If Aborted Then Exit Sub
  373.    Instring$ = Comm1.Input
  374.    Instring$ = Right$(Instring$, 120)
  375.    Instring$ = Mid$(Instring$, InStr(Instring$, "*") + 1, 80)
  376.    NewD = DateValue(Mid$(Instring$, 12, 2) + "/" + Mid$(Instring$, 15, 2) + "/" + Mid$(Instring$, 9, 2))
  377.    NewD = NewD + TimeValue(Mid$(Instring$, 18, 8))
  378.    NewD = NewD - (TimeZone.ListIndex - 11) * (1 / 24)
  379.    DSTFlag$ = Mid$(Instring$, 27, 2)
  380.    'If ((DSTFlag >= "01") And (DSTFlag <= "50")) Then
  381.    '   NewD = NewD - (1 / 24)
  382.    'End If
  383.    If DST.Value Then
  384.       NewD = NewD + (1 / 24)
  385.    End If
  386.    OldD = Date + Time
  387.    If Year(NewD) >= 1993 Then
  388.       Date = Format$(NewD, "mm/dd/yy")
  389.       Time = Format$(NewD, "hh:mm:ss")
  390.       If OldD > NewD Then
  391.          OffBy = "fast"
  392.       Else
  393.          OffBy = "slow"
  394.       End If
  395.       MsgBox "Time set to " + Format$(NewD, "hh:mm:ss") + ".  Clock was " + OffBy$ + " by " + Format$(Abs(NewD - OldD), "hh:mm:ss") + "."
  396.       Screen.MousePointer = 11
  397.       AtomicTimeWasSet = True
  398.       Status.Caption = "Time set."
  399.    Else
  400.       MsgBox "Error getting date and time."
  401.    End If
  402.    If Aborted Then Exit Sub
  403.    Screen.MousePointer = 11
  404.    HangUp
  405.    Screen.MousePointer = 0
  406.    If Aborted Then Exit Sub
  407.    On Local Error Resume Next
  408.    Unload Atomic
  409. End If
  410. If Index = 2 Then  'Cancel
  411.    If ControlsDisabled Then
  412.       Screen.MousePointer = 11
  413.       Status.Caption = "Cancelling."
  414.       HangUp
  415.       EnableControls
  416.       Aborted = True
  417.       Status.Caption = "Aborted."
  418.       Screen.MousePointer = 0
  419.    Else
  420.       Unload Atomic
  421.    End If
  422. End If
  423. EnableControls
  424. Exit Sub
  425. ErrHndl:
  426. If Instring$ <> "" Then
  427.    MsgBox "Error: " + Error(Err) + Chr$(13) + Chr$(10) + "Contents of buffer: " + Instring$
  428.    MsgBox "Error: " + Error(Err)
  429. End If
  430. If Comm1.PortOpen Then Comm1.PortOpen = False
  431. Aborted = True
  432. EnableControls
  433. Resume Next
  434. Exit Sub
  435. End Sub
  436. Sub DialString_GotFocus ()
  437. DialString.SelStart = 0
  438. DialString.SelLength = 32767
  439. End Sub
  440. Sub EnableControls ()
  441.    Command1(0).Enabled = True
  442.    Command1(1).Enabled = True
  443.    TimeZone.Enabled = True
  444.    DST.Enabled = True
  445.    DialString.Enabled = True
  446.    InitString.Enabled = True
  447.    Frame3D1.Enabled = True
  448.    ControlsDisabled = False
  449.    If Comm1.PortOpen Then Comm1.PortOpen = False
  450. End Sub
  451. Sub Form_Load ()
  452. Atomic.Left = Settings.Left + (Settings.Width / 2) - (Atomic.Width / 2)
  453. Atomic.Top = Settings.Top + (Settings.Height / 2) - (Atomic.Height / 2)
  454. TimeZone.AddItem "Greenwich + 11"
  455. TimeZone.AddItem "Greenwich + 10"
  456. TimeZone.AddItem "Greenwich + 9"
  457. TimeZone.AddItem "Greenwich + 8"
  458. TimeZone.AddItem "Greenwich + 7"
  459. TimeZone.AddItem "Greenwich + 6"
  460. TimeZone.AddItem "Greenwich + 5"
  461. TimeZone.AddItem "Greenwich + 4"
  462. TimeZone.AddItem "Greenwich + 3"
  463. TimeZone.AddItem "Greenwich + 2"
  464. TimeZone.AddItem "Greenwich + 1"
  465. TimeZone.AddItem "Greenwich"
  466. TimeZone.AddItem "Greenwich - 1"
  467. TimeZone.AddItem "Greenwich - 2"
  468. TimeZone.AddItem "Greenwich - 3"
  469. TimeZone.AddItem "Atlantic Standard Time (4)"
  470. TimeZone.AddItem "Eastern Standard Time"
  471. TimeZone.AddItem "Central Time"
  472. TimeZone.AddItem "Mountain Time"
  473. TimeZone.AddItem "Pacific Time"
  474. TimeZone.AddItem "Yukon Standard Time"
  475. TimeZone.AddItem "Alaska-Hawaii Standard Time"
  476. TimeZone.AddItem "Nome Standard Time"
  477. TimeZone.AddItem "Greenwich - 12"
  478. ResetDefaults
  479. LoadModemSettings
  480. 'Atomic.Show 1
  481. 'Command1(1).SetFocus
  482. End Sub
  483. Sub HangUp ()
  484.    Dim StartTime As Double
  485.    Dim I As Integer
  486.    Dim Ret As Integer
  487.    'Josh version  -
  488.    'comm1.PortOpen = False
  489.    'Exit Sub
  490.    'Beep
  491.    On Local Error GoTo ErrHndl2
  492.    'comm1.Output = "+++"
  493.    'StartTime = Timer
  494.    'While Timer - StartTime < .5
  495.    '  DoEvents
  496.    'Wend
  497.    'comm1.Output = "ATH0" + Chr$(13) + Chr(10)
  498.    Comm1.Output = ""
  499.    For I% = 1 To 3
  500.    StartTime = Timer
  501.    TString$ = Comm1.Input
  502.    Comm1.Output = "+"
  503.    While Timer - StartTime < .25
  504.      DoEvents
  505.    Wend
  506.    Next I%
  507.    'Do
  508.    '   DoEvents
  509.    'Loop Until comm1.InBufferCount >= 2
  510.    StartTime = Timer
  511.    While Timer - StartTime < 3#
  512.      DoEvents
  513.    Wend
  514.    TString$ = Comm1.Input
  515.    Comm1.Output = "ATH0" + Chr(13) + Chr(10)
  516.    StartTime = Timer
  517.    Do
  518.       DoEvents
  519.    Loop Until Comm1.InBufferCount >= 2 Or (Timer - StartTime) > 5
  520.    TString$ = Comm1.Input
  521.    StartTime = Timer
  522.    While Timer - StartTime < 1#
  523.      DoEvents
  524.    Wend
  525.    '3/28/92 version
  526.    Comm1.PortOpen = False
  527.    Exit Sub
  528.    Comm1.Output = "+++"
  529.    StartTime = Timer
  530.    While Timer - StartTime < .5
  531.      DoEvents
  532.    Wend
  533.    Comm1.Output = "ATH0" + Chr$(13) + Chr(10)
  534.    Ret = Comm1.DTREnable     'Save current setting
  535.    Comm1.DTREnable = True    'Turn DTR on
  536.      DoEvents
  537.    Comm1.DTREnable = False   'Turn DTR off
  538.      DoEvents
  539.    Comm1.DTREnable = Ret     'Restore old setting
  540.    Comm1.PortOpen = False
  541. ErrHndl2:
  542.   EnableControls
  543.   Exit Sub
  544. End Sub
  545. Sub InitString_GotFocus ()
  546. InitString.SelStart = 0
  547. InitString.SelLength = 32767
  548. End Sub
  549. Sub LoadModemSettings ()
  550. Dim lpReturnedString As String * 100
  551. Dim a As Integer
  552. lpReturnedString = Space$(100)
  553. a% = MyGetProfileString("AllTheTime", "TimeZoneIndex", "16", lpReturnedString$, 100)
  554. TimeZone.ListIndex = Val(lpReturnedString)
  555. a% = MyGetProfileString("AllTheTime", "DST", "0", lpReturnedString$, 100)
  556. DST.Value = Val(lpReturnedString)
  557. a% = MyGetProfileString("AllTheTime", "DialString", "ATDT 1 303 494-4774", lpReturnedString$, 100)
  558. DialString.Text = Trim$(lpReturnedString)
  559. a% = MyGetProfileString("AllTheTime", "ModemInitString", "ATZ", lpReturnedString$, 100)
  560. InitString.Text = Trim$(lpReturnedString)
  561. a% = MyGetProfileString("AllTheTime", "ComPort", "0", lpReturnedString$, 100)
  562. ComPort(Val(lpReturnedString)).Value = True
  563. End Sub
  564. Sub ResetDefaults ()
  565.    TimeZone.ListIndex = 16
  566.    DST.Value = 0
  567.    DialString.Text = "ATDT 1 303 494-4774"
  568.    InitString.Text = "ATZ"
  569.    ComPort(0).Value = True
  570.    'LoadModemSettings
  571. End Sub
  572. Sub SaveModemSettings ()
  573. Dim a As Integer
  574. Dim M As String
  575. Dim I As Integer
  576. a% = WritePrivateProfileString("AllTheTime", "TimeZoneIndex", TimeZone.ListIndex, "ATT.INI")
  577. a% = WritePrivateProfileString("AllTheTime", "DST", DST.Value, "ATT.INI")
  578. a% = WritePrivateProfileString("AllTheTime", "DialString", DialString.Text, "ATT.INI")
  579. a% = WritePrivateProfileString("AllTheTime", "ModemInitString", InitString.Text, "ATT.INI")
  580. M$ = "0"
  581. For I% = 0 To 3
  582.    If ComPort(I%).Value Then M$ = Str$(I%)
  583. Next I%
  584. a% = WritePrivateProfileString("AllTheTime", "ComPort", M$, "ATT.INI")
  585. End Sub
  586.