home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / adialr / telelist.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  16.1 KB  |  492 lines

  1. VERSION 2.00
  2. Begin Form Telelist 
  3.    BackColor       =   &H00C0C000&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "ADIALER"
  6.    ClientHeight    =   4005
  7.    ClientLeft      =   3120
  8.    ClientTop       =   2325
  9.    ClientWidth     =   5055
  10.    FontBold        =   -1  'True
  11.    FontItalic      =   0   'False
  12.    FontName        =   "MS Sans Serif"
  13.    FontSize        =   9.75
  14.    FontStrikethru  =   0   'False
  15.    FontUnderline   =   0   'False
  16.    ForeColor       =   &H00C0C000&
  17.    Height          =   4695
  18.    Icon            =   TELELIST.FRX:0000
  19.    Left            =   3060
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   4005
  23.    ScaleWidth      =   5055
  24.    Top             =   1695
  25.    Width           =   5175
  26.    Begin CommandButton QuitBut 
  27.       Caption         =   "Quit"
  28.       FontBold        =   -1  'True
  29.       FontItalic      =   0   'False
  30.       FontName        =   "MS Sans Serif"
  31.       FontSize        =   9.75
  32.       FontStrikethru  =   0   'False
  33.       FontUnderline   =   0   'False
  34.       Height          =   405
  35.       Left            =   3375
  36.       TabIndex        =   7
  37.       Top             =   3510
  38.       Width           =   930
  39.    End
  40.    Begin CommandButton DelNameBut 
  41.       Caption         =   "Delete Name"
  42.       FontBold        =   -1  'True
  43.       FontItalic      =   0   'False
  44.       FontName        =   "MS Sans Serif"
  45.       FontSize        =   9.75
  46.       FontStrikethru  =   0   'False
  47.       FontUnderline   =   0   'False
  48.       Height          =   450
  49.       Left            =   1395
  50.       TabIndex        =   6
  51.       Top             =   3375
  52.       Width           =   1455
  53.    End
  54.    Begin CommandButton ReDialBut 
  55.       Caption         =   "ReDial"
  56.       FontBold        =   -1  'True
  57.       FontItalic      =   0   'False
  58.       FontName        =   "MS Sans Serif"
  59.       FontSize        =   9.75
  60.       FontStrikethru  =   0   'False
  61.       FontUnderline   =   0   'False
  62.       Height          =   465
  63.       Left            =   135
  64.       TabIndex        =   12
  65.       Top             =   3375
  66.       Width           =   1140
  67.    End
  68.    Begin CommandButton TimeBut 
  69.       BackColor       =   &H00808000&
  70.       Caption         =   "Current Time"
  71.       FontBold        =   -1  'True
  72.       FontItalic      =   0   'False
  73.       FontName        =   "MS Sans Serif"
  74.       FontSize        =   9.75
  75.       FontStrikethru  =   0   'False
  76.       FontUnderline   =   0   'False
  77.       Height          =   420
  78.       Left            =   3105
  79.       TabIndex        =   8
  80.       Top             =   3015
  81.       Width           =   1725
  82.    End
  83.    Begin CommandButton AddNameBut 
  84.       Caption         =   "Add Name"
  85.       FontBold        =   -1  'True
  86.       FontItalic      =   0   'False
  87.       FontName        =   "MS Sans Serif"
  88.       FontSize        =   9.75
  89.       FontStrikethru  =   0   'False
  90.       FontUnderline   =   0   'False
  91.       Height          =   450
  92.       Left            =   1395
  93.       TabIndex        =   5
  94.       Top             =   2835
  95.       Width           =   1425
  96.    End
  97.    Begin CommandButton DialBut 
  98.       BackColor       =   &H00FFFFFF&
  99.       Caption         =   "Dial"
  100.       FontBold        =   -1  'True
  101.       FontItalic      =   0   'False
  102.       FontName        =   "MS Sans Serif"
  103.       FontSize        =   9.75
  104.       FontStrikethru  =   0   'False
  105.       FontUnderline   =   0   'False
  106.       Height          =   450
  107.       Left            =   135
  108.       TabIndex        =   4
  109.       Top             =   2835
  110.       Width           =   1155
  111.    End
  112.    Begin Frame Frame1 
  113.       BackColor       =   &H00E0FFFF&
  114.       Height          =   915
  115.       Left            =   3060
  116.       TabIndex        =   9
  117.       Top             =   2070
  118.       Width           =   1905
  119.       Begin CheckBox PrefixCBox 
  120.          BackColor       =   &H00E0FFFF&
  121.          Caption         =   "Use Prefix"
  122.          FontBold        =   -1  'True
  123.          FontItalic      =   0   'False
  124.          FontName        =   "MS Sans Serif"
  125.          FontSize        =   9.75
  126.          FontStrikethru  =   0   'False
  127.          FontUnderline   =   0   'False
  128.          ForeColor       =   &H00FF0000&
  129.          Height          =   330
  130.          Left            =   315
  131.          TabIndex        =   3
  132.          Top             =   495
  133.          Width           =   1275
  134.       End
  135.       Begin TextBox PrefixTxtBox 
  136.          BackColor       =   &H00FFFFFF&
  137.          FontBold        =   -1  'True
  138.          FontItalic      =   0   'False
  139.          FontName        =   "MS Sans Serif"
  140.          FontSize        =   9.75
  141.          FontStrikethru  =   0   'False
  142.          FontUnderline   =   0   'False
  143.          ForeColor       =   &H00808080&
  144.          Height          =   360
  145.          Left            =   1035
  146.          TabIndex        =   2
  147.          Top             =   135
  148.          Width           =   690
  149.       End
  150.       Begin Label Label2 
  151.          BackColor       =   &H00E0FFFF&
  152.          Caption         =   "Prefix :"
  153.          FontBold        =   -1  'True
  154.          FontItalic      =   0   'False
  155.          FontName        =   "MS Sans Serif"
  156.          FontSize        =   9.75
  157.          FontStrikethru  =   0   'False
  158.          FontUnderline   =   0   'False
  159.          ForeColor       =   &H00FF0000&
  160.          Height          =   285
  161.          Left            =   180
  162.          TabIndex        =   10
  163.          Top             =   180
  164.          Width           =   690
  165.       End
  166.    End
  167.    Begin Frame Frame2 
  168.       BackColor       =   &H00E0FFFF&
  169.       Caption         =   "Enter Number to Call"
  170.       FontBold        =   -1  'True
  171.       FontItalic      =   0   'False
  172.       FontName        =   "MS Sans Serif"
  173.       FontSize        =   9.75
  174.       FontStrikethru  =   0   'False
  175.       FontUnderline   =   0   'False
  176.       ForeColor       =   &H000000FF&
  177.       Height          =   690
  178.       Left            =   90
  179.       TabIndex        =   11
  180.       Top             =   2070
  181.       Width           =   2985
  182.       Begin TextBox EnterNumTxtBox 
  183.          Height          =   330
  184.          Left            =   180
  185.          TabIndex        =   1
  186.          Top             =   270
  187.          Width           =   2445
  188.       End
  189.    End
  190.    Begin ListBox TeleListBox 
  191.       BackColor       =   &H00E0FFFF&
  192.       FontBold        =   -1  'True
  193.       FontItalic      =   0   'False
  194.       FontName        =   "MS Sans Serif"
  195.       FontSize        =   9.75
  196.       FontStrikethru  =   0   'False
  197.       FontUnderline   =   0   'False
  198.       Height          =   1950
  199.       Left            =   90
  200.       Sorted          =   -1  'True
  201.       TabIndex        =   0
  202.       Top             =   135
  203.       Width           =   4875
  204.    End
  205.    Begin Menu ConfigMen 
  206.       Caption         =   "Configure"
  207.       Begin Menu ComPortMen 
  208.          Caption         =   "Com Port"
  209.          Begin Menu Com1Men 
  210.             Caption         =   "Com 1"
  211.          End
  212.          Begin Menu Com2Men 
  213.             Caption         =   "Com 2"
  214.          End
  215.          Begin Menu Com3Men 
  216.             Caption         =   "Com 3"
  217.          End
  218.          Begin Menu Com4Men 
  219.             Caption         =   "Com 4"
  220.          End
  221.       End
  222.    End
  223. Dim ComMenChk As Integer
  224. Sub AddNameBut_Click ()
  225.     NameIn.Show
  226. End Sub
  227. Sub Check1_Click ()
  228. 'To avoid dialog box on startup check for ComNo$ which will not be prensent at startup
  229.     If Left$(ComNo$, 3) = "Com" Then
  230.         If MsgBox("Make this setting the default?", 292) = 7 Then
  231.         Exit Sub
  232.         End If
  233.     End If
  234. 'Write Prefix data to ADIALER.INI to make it default
  235.     If PrefixCBox.Value = 1 Then
  236.         lpstring$ = "On"
  237.     ElseIf PrefixCBox.Value = 0 Then
  238.         lpstring$ = "Off"
  239.     End If
  240.     lpAppName$ = "Prefix"
  241.     lpFileName$ = "ADIALER.INI"
  242.     lpKeyName$ = "On/Off"
  243.     WritePreIndex% = WritePrivateProfileString(lpAppName$, lpKeyName$, lpstring$, lpFileName$)
  244. End Sub
  245. Sub Com1Men_Click ()
  246.  'Set the check on menus
  247.     ComNo$ = "Com1"
  248.     Com1Men.Checked = -1
  249.     Com2Men.Checked = 0
  250.     Com3Men.Checked = 0
  251.     Com4Men.Checked = 0
  252.  'Set ComPort setting in ADIALER.INI file with Sub Function
  253.     SetComVar = SetComPort(ComNo$)
  254. End Sub
  255. Sub Com2Men_Click ()
  256.      ComNo$ = "Com2"
  257.     Com1Men.Checked = 0
  258.     Com2Men.Checked = -1
  259.     Com3Men.Checked = 0
  260.     Com4Men.Checked = 0
  261.  'Set ComPort setting in ADIALER.INI file with Sub Function
  262.     SetComVar = SetComPort(ComNo$)
  263. End Sub
  264. Sub Com3Men_Click ()
  265.     ComNo$ = "Com3"
  266.     Com1Men.Checked = 0
  267.     Com2Men.Checked = 0
  268.     Com3Men.Checked = -1
  269.     Com4Men.Checked = 0
  270.     ComMenChk% = 3
  271.  'Set ComPort setting in ADIALER.INI file with Sub Function
  272.     SetComVar = SetComPort(ComNo$)
  273. End Sub
  274. Sub Com4Men_Click ()
  275.      ComNo$ = "Com4"
  276.     Com1Men.Checked = 0
  277.     Com2Men.Checked = 0
  278.     Com3Men.Checked = 0
  279.     Com4Men.Checked = -1
  280.     ComMenChk% = 4
  281.  'Set ComPort setting in ADIALER.INI file with Sub Function
  282.     SetComVar = SetComPort(ComNo$)
  283. End Sub
  284. Sub Command1_Click ()
  285.     CR$ = Chr$(13) + Chr$(10)
  286.     ComNo$ = "Com2"
  287.     OpenCom% = OpenComm(ComNo$, 128, 64)
  288.     If OpenCom% < 0 Then
  289.         MsgBox "Couldn't open Com Port" + CR$ + "Check configuration!!"
  290.         Exit Sub
  291.     End If
  292.     DialString$ = "ATDT" + "723-7429" + CR$
  293.     ModemWrite% = WriteComm(OpenCom%, DialString$, 20)
  294. 'Pause loop
  295.     For I = 1 To 100
  296.         For I2 = 1 To 1000
  297.         Next I2
  298.     Next I
  299.     MsgBox "Pick up the phone and press Enter"
  300. 'Turn off modem
  301.     Break$ = "+++~~~ATH" + CR$
  302.     ModemOff% = WriteComm(OpenCom%, Break$, 20)
  303. If CloseComm(1) < 0 Then
  304.         MsgBox "Com port not closed"
  305.     End If
  306. End Sub
  307. Sub DelNameBut_Click ()
  308. 'Make sure the file is supposed to be deleted
  309.     If MsgBox("Are you sure you want to delete this entry", 36) = 7 Then
  310.         Exit Sub
  311.     End If
  312. 'First delete the old ADIALER.INI file with Sub Procedure from ADIALER.BAS
  313.     DelNamIni
  314. 'Next delete item in listBox
  315.     DelIndex% = TeleListBox.ListIndex
  316.     TeleListBox.RemoveItem DelIndex%
  317.     TeleListBox.Refresh
  318. 'Next update the list in the ADIALER.INI file with a Sub Procedure
  319.     UpdateNamIni
  320. End Sub
  321. Sub DialBut_Click ()
  322. 'Check to make sure there is a name and number
  323.     If EnterNumTxtBox.Text = "" Then
  324.         If TeleListBox.Text = "" Then
  325.             MsgBox "No number specified"
  326.         End If
  327.     End If
  328. 'Determine source of phone number
  329.     If EnterNumTxtBox.Text <> "" Then
  330.         PhoneNum$ = EnterNumTxtBox.Text
  331.         EnterNumTxtBox.Text = "" 'Clears number from entry box
  332.     Else
  333.         PhoneNum$ = TeleListBox.Text
  334.     End If
  335. 'Dial the phone number using a sub procedure in ADIALER.INI
  336.     Dial
  337. End Sub
  338. Sub DialBut2_Click ()
  339.     CR$ = Chr$(13) + Chr$(10)
  340. 'Check that a name and number have been selected
  341.     If TeleListBox.Text = "" Then
  342.         If EnterNumTxtBox.Text = "" Then
  343.             MsgBox "No Name specified!"
  344.             Exit Sub
  345.         End If
  346.     End If
  347.     PhoneNum$ = TeleListBox.Text
  348.     If EnterNumTxtBox.Text <> "" Then
  349.         PhoneNum$ = EnterNumTxtBox.Text
  350.         EnterNumTxtBox.Text = ""
  351.     End If
  352. 'Dial phone by call Dial sub procedure in ADIALER.BAS
  353.     Dial
  354. End Sub
  355. Sub Form_Load ()
  356. 'Center the form on loading
  357.     Left = (Screen.Width - Width) / 2
  358.     Top = (Screen.Height - Height) / 2
  359.     CR$ = Chr$(13) + Chr$(10)
  360.     Load NameIn  'Loads input dialog box
  361. 'Set up the Prefix On/Off option
  362.  'First check for ADIALER.INI file using the FileCheck value
  363.     lpApplication$ = "FileCheck"
  364.     lpKeyName$ = "CheckString"
  365.     Dim CheckIniStr As String * 5 'make fixed length because of DLL return
  366.     lpDefault$ = "No"
  367.     nSize% = 5
  368.     lpFileName$ = "ADIALER.INI"
  369.     CheckVar% = GetPrivateProfileString(lpApplication$, lpKeyName$, lpDefault$, CheckIniStr$, nSize%, lpFileName$)
  370.         If Left$(CheckIniStr$, 3) <> "Yes" Then
  371.             MsgRet% = MsgBox("Could not find ADIALER.INI file" + CR$ + "It will be created in Windows directory!" + CR$ + "You will need to reconfigure.")
  372.             lpstring$ = "Yes"
  373.         WriteVar% = WritePrivateProfileString(lpApplication$, lpKeyName$, lpstring$, lpFileName$)
  374.     End If
  375.  'Get prefix
  376.     lpApplication$ = "Prefix"
  377.     lpKeyName$ = "On/Off"
  378.     Dim PrefixOnOff As String * 4  'make fixed length because of DLL return
  379.     lpDefault$ = "Off"
  380.     nSize% = 4
  381.  'Gets Prefix On or Off from ADIALER.INI and checks the menu selection
  382.     GetPrefixVar% = GetPrivateProfileString(lpApplication$, lpKeyName$, lpDefault$, PrefixOnOff$, nSize%, lpFileName$)
  383.     If Left$(PrefixOnOff$, 3) = "Off" Then
  384.         PrefixCBox.Value = 0
  385.     Else
  386.         PrefixCBox.Value = 1
  387.     End If
  388. 'Set up the Prefix textbox from ADIALER.INI
  389.     lpApplication$ = "Prefix"
  390.     lpKeyName$ = "Prefix String"
  391.     Dim PrefixStr As String * 3  'make fixed length because of DLL return
  392.     lpDefault$ = ""
  393.     nSize% = 3
  394.  'Gets Prefix string from ADIALER.INI and checks the menu selection
  395.     GetPrefixStrVar% = GetPrivateProfileString(lpApplication$, lpKeyName$, lpDefault$, PrefixStr$, nSize%, lpFileName$)
  396.     PrefixTxtBox.Text = PrefixStr$
  397. 'Set up the ComPort from ADIALER.INI file
  398.     lpApplication$ = "ComPort"
  399.     lpKeyName$ = "ComNo"
  400.     lpDefault$ = "Com2"
  401.     nSize% = 5
  402.     lpFileName$ = "ADIALER.INI"
  403.  'Gets Com Number from ADIALER.INI and checks the menu selection
  404.     GetComPortVar% = GetPrivateProfileString(lpApplication$, lpKeyName$, lpDefault$, ComNo$, nSize%, lpFileName$)
  405.     If ComNo$ = "Com1" Then
  406.         Com1Men.Checked = -1
  407.     ElseIf ComNo$ = "Com2" Then
  408.         Com2Men.Checked = -1
  409.     ElseIf ComNo$ = "Com3" Then
  410.         Com3Men.Checked = -1
  411.     ElseIf ComNo$ = "Com4" Then
  412.         Com4Men.Checked = -1
  413.     End If
  414. 'Fill the TeleListBox
  415.  'List Box loading loop
  416.     lpApplication$ = "Names and Numbers"
  417.     lpDefault$ = "Empty"
  418.     Dim LoadStr As String * 50
  419.     nSize% = 60
  420.     Do
  421.         I = I + 1
  422.         lpKeyName$ = "Name" + Str$(I)
  423.         GetStringVar% = GetPrivateProfileString(lpApplication$, lpKeyName$, lpDefault$, LoadStr$, nSize%, lpFileName$)
  424.     'Stop loop if reach end of data
  425.         If Len(RTrim$(LoadStr$)) < 3 Then
  426.             Exit Sub
  427.         ElseIf Left$(LoadStr$, 5) = "Empty" Then
  428.             Exit Sub
  429.         End If
  430.         TeleListBox.AddItem RTrim$(LoadStr$)
  431.         LoadStr$ = ""
  432.     Loop
  433. End Sub
  434. Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  435.     If Button = 2 Then MouseBut% = 2
  436. End Sub
  437. Sub PrefixCBox_Click ()
  438. 'To avoid dialog box on startup check for ComNo$ which will not be prensent at startup
  439.     If Left$(ComNo$, 3) = "Com" Then
  440.         If MsgBox("Make this setting the default?", 292) = 7 Then
  441.         Exit Sub
  442.         End If
  443.     End If
  444. 'Write Prefix data to ADIALER.INI to make it default
  445.     If PrefixCBox.Value = 1 Then
  446.         lpstring$ = "On"
  447.     ElseIf PrefixCBox.Value = 0 Then
  448.         lpstring$ = "Off"
  449.     End If
  450.     lpAppName$ = "Prefix"
  451.     lpFileName$ = "ADIALER.INI"
  452.     lpKeyName$ = "On/Off"
  453.     WritePreIndex% = WritePrivateProfileString(lpAppName$, lpKeyName$, lpstring$, lpFileName$)
  454. End Sub
  455. Sub PrefixTxtBox_Change ()
  456. 'Write Prefix string to ADIALER.INI to make it default
  457.     lpAppName$ = "Prefix"
  458.     lpFileName$ = "ADIALER.INI"
  459.     lpKeyName$ = "Prefix String"
  460.     lpstring$ = PrefixTxtBox.Text
  461.     WritePreIndex% = WritePrivateProfileString(lpAppName$, lpKeyName$, lpstring$, lpFileName$)
  462. End Sub
  463. Sub QuitBut_Click ()
  464.     End
  465. End Sub
  466. Sub ReDialBut_Click ()
  467.     Dial
  468. End Sub
  469. Sub TeleListBox_DblClick ()
  470.     DialBut.Value = -1
  471. End Sub
  472. Sub Text1_Change ()
  473. 'Write Prefix string to ADIALER.INI to make it default
  474.     lpAppName$ = "Prefix"
  475.     lpFileName$ = "ADIALER.INI"
  476.     lpKeyName$ = "Prefix String"
  477.     lpstring$ = PrefixTxtBox.Text
  478.     WritePreIndex% = WritePrivateProfileString(lpAppName$, lpKeyName$, lpstring$, lpFileName$)
  479. End Sub
  480. Sub TimeBox_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  481.     TimeBut.Print Format$(Now, "h:mm am/pm")
  482. End Sub
  483. Sub TimeBut_Click ()
  484.     TimeBut.Caption = Format$(Now, "h:mm am/pm")
  485. 'Delay loop for one second
  486.     Start! = Timer
  487.     Do Until Finish! > Start! + 1
  488.         Finish! = Timer
  489.     Loop
  490.     TimeBut.Caption = "Current Time"
  491. End Sub
  492.