home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 1999 October / PCpro_1999_10.ISO / Tools / dialer98 / Source / Module1.bas < prev    next >
Encoding:
BASIC Source File  |  1998-05-06  |  20.7 KB  |  646 lines

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3.  
  4.  
  5. Public Const Title = "Dialer98-Pro"
  6. Public Const VersionString = "[DIALER97 VERSION 2.2]"
  7. Public Const Version20String = "[DIALER97 VERSION 2.0]"
  8. Public Const ProviderFile = "Provider.DAT"
  9. Public Const ProviderBakFile = "Provider.BAK"
  10. Public Const DataFile = "Dialer97.DAT"
  11. Public Const DataBakFile = "Dialer97.BAK"
  12. Public Const UpdateFile = "Update.DAT"
  13. Public Const UpdateTitle = "Provider-Update"
  14. Public Const UpdateSig = "Dialer98 Pro Provider Update"
  15. '-> TRUE one
  16. Public Const UpdateUrl = "http://www.zdnet.de/download/service/ttarif/ttarif.csv"
  17.  
  18. '-> DEBUG!
  19. 'Public Const UpdateUrl = "http://localhost/wsdocs/ttarif.csv"
  20. 'Public Const UpdateUrl = "HTTP://perso.wanadoo.fr/wolfgang.wirth/ttarif.txt"
  21.  
  22. Public Const NamListPic = 1
  23. Public Const OptionPic = 5
  24. Public Const OptionsTab = 5
  25.  
  26. Public Const siVorwahl = 1
  27. Public Const siTag = 2
  28. Public Const siAb = 3
  29. Public Const siBis = 4
  30. Public Const siWeite = 5
  31.  
  32. Public UpdateFailed As Boolean
  33.  
  34. Public RcvString As String
  35. Public DummyStr As String
  36. Public DummyInt As Integer
  37.  
  38. Public sep As String
  39.  
  40. '### TimeSlider zeigt seltsames verhalten ... ???
  41. '### daher von bis ueber dier vars ⁿbergeben
  42. Public TimeSliderVon As Integer
  43. Public TimeSliderBis As Integer
  44.  
  45. Public PicActiv As Integer
  46.  
  47. Public ThisIsANewEntry As Boolean
  48. Public ExternalWindowActive As Boolean
  49. Public CurrTelcoEntry As Long
  50.  
  51. Public CommPortNummer As Integer
  52. Public PulsWahl As Integer
  53. Public AmtPrefix As String
  54. Public AuslandPrefix As String
  55. Public OrtsKennZahl As String
  56. Public LandesKennZahl As String
  57. Public ZusModemBefehleVorDerWahl As String
  58. Public UebergabeTelNr As String
  59. Public MacheUebergabe As Integer
  60. Public IsV20 As Boolean
  61.  
  62. Public Const cDistanzNah = 1
  63. Public Const cDistanzFern = 2
  64. Public Const cDistanzAusland = 3
  65. Public Const cNFA = "NFA" ' Nah Fern Ausland
  66.  
  67. Public Const cTagWerktags = "Mo-Fr"
  68. Public Const cTagWochenende = "Sa-So"
  69. Public Const cTagImmer = "Immer"
  70.  
  71. Public Const cLeftClick = 1
  72. Public Const cRightClick = 2
  73. Public Const cLeftDblClick = &H101
  74. Public Const cRightDblClick = &H102
  75.  
  76. 'Benutzerdef. Variable zum ▄bermitteln der Shell_NotifyIcon-Info
  77. Public Type NOTIFYICONDATA
  78.    cbSize As Long
  79.    hWnd As Long
  80.    uId As Long
  81.    uFlags As Long
  82.    uCallBackMessage As Long
  83.    hIcon As Long
  84.    szTip As String * 64
  85. End Type
  86.  
  87. 'Die Shell_NotifyIcon-Kommandos
  88. Public Const NIM_ADD = &H0
  89. Public Const NIM_MODIFY = &H1
  90. Public Const NIM_DELETE = &H2
  91.  
  92. 'Die Shell_NotifyIcon-Flags
  93. Public Const NIF_MESSAGE = &H1
  94. Public Const NIF_ICON = &H2
  95. Public Const NIF_TIP = &H4
  96.  
  97. 'Das ist die Windows-Message, die fⁿr das M÷chtegern-Callback
  98. 'benutzt wird.
  99. Public Const WM_MOUSEMOVE = &H200
  100.  
  101. 'Div. Mausklicks
  102. Public Const WM_LBUTTONDBLCLK = &H203   'Double-click
  103. Public Const WM_LBUTTONDOWN = &H201     'Button down
  104. Public Const WM_RBUTTONDBLCLK = &H206   'Double-click
  105. Public Const WM_RBUTTONDOWN = &H204     'Button down
  106.  
  107. 'Die Shell_NotifyIcon-Funktion
  108. Public Declare Function Shell_NotifyIconA Lib "shell32" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
  109.  
  110. 'Hilfsvariablen um den SingleKlick auswerten zu k÷nnen (wird nicht vom System geliefert!)
  111. Public NiKeyEventDblClickFlag As Integer
  112. Public NiKeyEventButtonID As Integer
  113.  
  114. Sub ShowInfo()
  115.     ww_info Title, "Die professionelle Wahlhilfe fⁿr Windows 95/NT" + vbCr + _
  116.                           "mit automatischer Provider-Auswahl"
  117. End Sub
  118.  
  119. Sub ww_info(t As String, s As String)
  120.     MsgBox s + vbCr + vbCr + "⌐ 1996 - 1998 by Wolfgang Wirth" + vbCr + vbCr + "'VerbesserungsvorschlΣge und konstruktive" + vbCr + "Kritik sind immer willkommen ...'" + vbCr + vbCr + "E-Mail: Wolfgang.Wirth@Wanadoo.fr", 64, t
  121. End Sub
  122.  
  123. Sub VonBisStr2Num(sVonBis As String, iVon As Integer, iBis As Integer)
  124.     '### aufbau des str. "VVh_-_BBh"
  125.     iVon = Val(Left(sVonBis, 2))
  126.     iBis = Val(Mid(sVonBis, 7, 2))
  127. End Sub
  128.  
  129. Sub VonBisNum2Str(iVon As Integer, iBis As Integer, sVonBis As String)
  130.     '### aufbau des str. "VVh_-_BBh"
  131.     sVonBis = Right(Format(100 + iVon), 2) + "h - " + Right(Format(100 + iBis), 2) + "h"
  132. End Sub
  133.  
  134. Sub WeiteNum2Str(iWeite As Integer, sWeite As String)
  135. Dim i As Integer
  136.     sWeite = ""
  137.     For i = 0 To 2
  138.         If 2 ^ i And iWeite Then sWeite = sWeite + Mid(cNFA, i + 1, 1)
  139.     Next
  140. End Sub
  141.  
  142. Sub WeiteStr2Num(sWeite As String, iWeite As Integer)
  143. Dim i As Integer
  144.     iWeite = 0
  145.     For i = 0 To 2
  146.         If InStr(sWeite, Mid(cNFA, i + 1, 1)) Then iWeite = iWeite Or 2 ^ i
  147.     Next
  148. End Sub
  149.  
  150. Function SelectedItemIndex(Lv As ListView) As Long
  151. Dim i As Long
  152.         For i = 1 To Lv.ListItems.Count
  153.             If Lv.ListItems(i).Selected Then
  154.                 SelectedItemIndex = i
  155.                 Exit For
  156.             End If
  157.         Next '### ist 0, falls nix sel. ist
  158. End Function
  159.  
  160. Sub AddToTelcoList(sAnbieter As String, sVorwahl As String, iWerktags As Integer, iWochenende As Integer, iAb As Integer, iBis As Integer, iNah As Integer, iFern As Integer, iAusland As Integer)
  161. Dim i As Long
  162. Dim s As String
  163.     With Form1.TelcoList
  164.         .Sorted = False
  165.         i = .ListItems.Count + 1
  166.         i = 1 '*'*'*'*▀▀▀▀▀▀▀▀▀▀▀
  167.         .ListItems.Add i, , Trim(sAnbieter)
  168.         .ListItems(i).SubItems(siVorwahl) = Trim(sVorwahl)
  169.         Select Case iWerktags Or 2 * iWochenende
  170.             Case 1
  171.                 s = cTagWerktags
  172.             Case 2
  173.                 s = cTagWochenende
  174.             Case 3
  175.                 s = cTagImmer
  176.         End Select
  177.         .ListItems(i).SubItems(siTag) = s
  178.         .ListItems(i).SubItems(siAb) = Right$("0" & iAb & "h", 3)
  179.         .ListItems(i).SubItems(siBis) = Right$("0" & iBis & "h", 3)
  180.         s = ""
  181.         If iNah Then s = s + "N"
  182.         If iFern Then s = s + "F"
  183.         If iAusland Then s = s + "A"
  184.         .ListItems(i).SubItems(siWeite) = s
  185.         .Sorted = True
  186.     End With
  187. End Sub
  188.  
  189. Function BestProvider(Wochentag As Integer, Stunde As Integer, Distanz As Integer) As String
  190. Dim i As Long
  191. Dim s As String
  192.     Debug.Print "BestProvider (Wochentag,Stunde,Distanz): "; Wochentag; Stunde; Distanz;
  193.     With Form1.TelcoList
  194.         For i = 1 To .ListItems.Count
  195.             s = .ListItems(i).SubItems(siTag)
  196.             If ((s = cTagImmer) Or ((s = cTagWerktags) And (Wochentag <= 5)) Or ((s = cTagWochenende) And (Wochentag >= 6))) And _
  197.                ((Stunde >= Val(.ListItems(i).SubItems(siAb))) And (Stunde < Val(.ListItems(i).SubItems(siBis)))) And _
  198.                (InStr(.ListItems(i).SubItems(siWeite), Mid$(cNFA, Distanz, 1)) <> 0) Then '### treffer
  199.                     s = .ListItems(i).SubItems(siVorwahl)
  200.                     Debug.Print " --> "; s:
  201.                     BestProvider = s
  202.                     Exit For
  203.             End If
  204.         Next
  205.     End With
  206.     Debug.Print
  207. End Function
  208.  
  209. Public Sub SaveProviderFile()
  210. Dim s As String
  211. Dim d As String
  212. Dim f As Integer
  213. Dim i As Integer
  214.  
  215. If Dir$(ProviderBakFile) <> "" Then Kill ProviderBakFile
  216. If Dir$(ProviderFile) <> "" Then Name ProviderFile As ProviderBakFile
  217. f = FreeFile
  218. Open ProviderFile For Output As f
  219. For i = 1 To Form1.TelcoList.ListItems.Count
  220.     With Form1.TelcoList.ListItems(i)
  221.         s = .SubItems(siTag)
  222.         d = .SubItems(siWeite)
  223.         Write #f, .Text, .SubItems(siVorwahl), _
  224.             -(s = cTagImmer) Or -(s = cTagWerktags), -(s = cTagImmer) Or -(s = cTagWochenende), _
  225.             Val(.SubItems(siAb)), Val(.SubItems(siBis)), _
  226.             -(InStr(d, "N") <> 0), -(InStr(d, "F") <> 0), -(InStr(d, "A") <> 0)
  227.     End With
  228. Next
  229. Close f
  230. End Sub
  231.  
  232. Public Sub LoadProviderFile()
  233. Dim f As Integer
  234. Dim sAnbieter As String
  235. Dim sVorwahl As String
  236. Dim iWerktags As Integer
  237. Dim iWochenende As Integer
  238. Dim iAb As Integer
  239. Dim iBis As Integer
  240. Dim iNah As Integer
  241. Dim iFern As Integer
  242. Dim iAusland As Integer
  243.  
  244. f = FreeFile
  245. Open ProviderFile For Input As f
  246. Do While Not EOF(f)
  247.     Input #f, sAnbieter, sVorwahl, iWerktags, iWochenende, iAb, iBis, iNah, iFern, iAusland
  248.     AddToTelcoList sAnbieter, sVorwahl, iWerktags, iWochenende, iAb, iBis, iNah, iFern, iAusland
  249. Loop
  250. Close f
  251. End Sub
  252.  
  253. Public Sub LoadDataFile()
  254.  
  255. Dim MyFontsize As Integer
  256. Dim i As Integer
  257. Dim ZeroFlagDigit As Integer
  258. Dim NameStr As String
  259. Dim TelefonNrStr As String
  260.  
  261. Input #1, CommPortNummer, PulsWahl, DummyInt, AmtPrefix, _
  262.               DummyInt, AuslandPrefix, LandesKennZahl, _
  263.               MyFontsize, ZusModemBefehleVorDerWahl, _
  264.               UebergabeTelNr, MacheUebergabe
  265.     
  266. '### LandesKennZahl und Ortskennzahl werden im gl. string gehalten getrennt durch ein "|"
  267. LandesKennZahl = Trim(LandesKennZahl)
  268. If (LandesKennZahl = "0") Or (LandesKennZahl = "") Or (LandesKennZahl = "|") Then
  269.     LandesKennZahl = "49"
  270. End If
  271. i = InStr(LandesKennZahl, "|")
  272. If i Then
  273.     OrtsKennZahl = Trim(Mid(LandesKennZahl, i + 1))
  274.     LandesKennZahl = Trim(Left(LandesKennZahl, i - 1))
  275. End If
  276.  
  277. For i = 1 To 4
  278.     Form1.NamList(i).Font.Size = MyFontsize
  279.     Input #1, NameStr
  280.     Form1.TabStrip1.Tabs(i).Caption = NameStr
  281. Next
  282.  
  283. Do While Not EOF(1)
  284.     Input #1, i
  285.     If i = 0 Then Exit Do
  286.     Input #1, NameStr, TelefonNrStr
  287.     If IsV20 Then
  288.         ZeroFlagDigit = 1
  289.     Else
  290.         Input #1, ZeroFlagDigit     '<-bei nationaler Anwahl eine 0 voranstellen
  291.         ZeroFlagDigit = ZeroFlagDigit And 1
  292.     End If
  293.     Form1.NamList(i).AddItem Trim(NameStr) + sep + Trim(TelefonNrStr) + "~" + Chr$(48 + ZeroFlagDigit)
  294. Loop
  295.     
  296. End Sub
  297.  
  298. Public Sub SaveDataFile()
  299. Dim s As String
  300. Dim f As Integer
  301. Dim i As Integer
  302. Dim j As Integer
  303. Dim NamensStr As String
  304. Dim TelefonNrStr As String
  305.  
  306.         If Dir$(DataBakFile) <> "" Then Kill DataBakFile
  307.         If Dir$(DataFile) <> "" Then Name DataFile As DataBakFile
  308.         
  309.         f = FreeFile
  310.         Open DataFile For Output As f
  311.         ExchangeQuotes AmtPrefix
  312.         ExchangeQuotes AuslandPrefix
  313.         ExchangeQuotes ZusModemBefehleVorDerWahl
  314.         ExchangeQuotes UebergabeTelNr
  315.         Print #f, VersionString
  316.         Write #f, CommPortNummer, PulsWahl, DummyInt, AmtPrefix, _
  317.                         DummyInt, AuslandPrefix, LandesKennZahl + "|" + OrtsKennZahl, _
  318.                         Form1.FntSmpl.Font.Size, ZusModemBefehleVorDerWahl, _
  319.                         UebergabeTelNr, MacheUebergabe
  320.         
  321.         For i = 1 To 4
  322.             NamensStr = Form1.TabStrip1.Tabs(i).Caption
  323.             ExchangeQuotes NamensStr
  324.             If i = 4 Then
  325.                 Write #f, NamensStr
  326.             Else
  327.                 Write #f, NamensStr;
  328.             End If
  329.         Next
  330.         For j = 1 To 4
  331.             For i = 0 To Form1.NamList(j).ListCount - 1
  332.                 s = Form1.NamList(j).List(i)
  333.                 NamensStr = Trim(Teilnehmername(s))
  334.                 TelefonNrStr = Trim(TelefonNummer(s))
  335.                 ExchangeQuotes NamensStr
  336.                 ExchangeQuotes TelefonNrStr
  337.                 Write #f, j, NamensStr, TelefonNrStr, ZeroFlag(s)
  338.             Next
  339.         Next
  340.         Close f
  341. End Sub
  342.  
  343. Public Function TelefonNummerMitZeroFlag(s As String) As String
  344.     TelefonNummerMitZeroFlag = Mid$(s, InStr(s, sep) + Len(sep))
  345. End Function
  346.  
  347. Public Function TelefonNummer(s As String) As String
  348. Dim tmps As String
  349.     tmps = TelefonNummerMitZeroFlag(s)
  350.     TelefonNummer = Left$(tmps, Len(tmps) - 2)
  351. End Function
  352.  
  353. Public Sub ExchangeQuotes(s As String)
  354. Dim i As Long
  355.     For i = 1 To Len(s)
  356.         If Mid$(s, i, 1) = Chr$(34) Then Mid$(s, i, 1) = "'"
  357.     Next
  358. End Sub
  359.  
  360. Public Function Teilnehmername(s As String) As String
  361.     Teilnehmername = Left$(s, InStr(s, sep) - 1)
  362. End Function
  363.  
  364. Public Function ZeroFlag(s As String) As Integer
  365.     ZeroFlag = Val(Right$(TelefonNummerMitZeroFlag(s), 1))
  366. End Function
  367.  
  368. Public Sub EditNameEntry(nam As String, tel As String, i As Integer)
  369.     With Form2
  370.         .Text1(0).Text = nam
  371.         .Text1(1).Text = tel
  372.         .ZeroChk.Value = i
  373.         ThisIsANewEntry = (nam = "") And (tel = "")
  374.         ExternalWindowActive = True
  375.         .Show 1
  376.         ExternalWindowActive = False
  377.     End With
  378. End Sub
  379.  
  380. Public Sub EditProviderEntry(nam As String, num As String, TageIdx As Integer, von As Integer, bis As Integer, ivN As Integer, ivF As Integer, ivA As Integer)
  381.     With Form3
  382.         TimeSliderVon = von
  383.         TimeSliderBis = bis
  384.         .Text1(0).Text = nam
  385.         .Text1(1).Text = num
  386.         If TageIdx Then
  387.             .OptTage(TageIdx).Value = True
  388.         Else
  389.             .OptTage(1).Value = True
  390.         End If
  391.         .ChkWeite(1).Value = ivN
  392.         .ChkWeite(2).Value = ivF
  393.         .ChkWeite(3).Value = ivA
  394.         ThisIsANewEntry = (nam = "") And (num = "")
  395.         ExternalWindowActive = True
  396.         .Show 1
  397.         ExternalWindowActive = False
  398.     End With
  399. End Sub
  400.  
  401. Public Sub InitMyApp()
  402.  
  403. Dim s As String
  404. Dim t As String
  405. Dim i As Long
  406. Dim DoUpdate As Boolean
  407.  
  408. sep = String$(150, 32) + Chr$(1)
  409.  
  410. PicActiv = NamListPic
  411. Form1.Picture1(PicActiv).ZOrder 0
  412.  
  413. If Dir$(DataFile) = "" Then
  414.     MacheUebergabe = 0
  415.     CommPortNummer = 1
  416.     PulsWahl = 1
  417.     AmtPrefix = ""
  418.     AuslandPrefix = "00"
  419.     LandesKennZahl = "49"
  420.     OrtsKennZahl = ""
  421.     SaveDataFile
  422.     MsgBox "Es wurde eine neue Telefon- und Einstellungendatei angelegt." + vbCr + "Sie sollten daher die Programmeinstellungen jetzt ⁿberprⁿfen!", 64, Title
  423.     ShowOptionsTab
  424. Else
  425.     Open DataFile For Input As #1
  426.     Line Input #1, s
  427.     s = Trim(s)
  428.     Select Case s
  429.         Case VersionString
  430.             IsV20 = False
  431.             LoadDataFile
  432.         Case Version20String
  433.             IsV20 = True
  434.             LoadDataFile
  435.             DoUpdate = True
  436.         Case Else
  437.             MsgBox "Die Telefonliste ist nicht kompatibel und" + vbCr + _
  438.                 "kann daher nicht eingelesen werden." + vbCr + vbCr + _
  439.                 "Das Programm wird abgebrochen", vbCritical, Title
  440.             End
  441.         End Select
  442.     Close #1
  443.     If DoUpdate Then SaveDataFile
  444. End If
  445.  
  446. If Dir$(ProviderFile) <> "" Then
  447.     LoadProviderFile
  448. End If
  449.  
  450. 'AddToTelcoList "Arcor", "01070", 0, 1, 12, 18, 1, 0, 0
  451. 'AddToTelcoList "Arcor", "01070", 1, 0, 22, 24, 0, 1, 0
  452. 'AddToTelcoList "Arcor", "01070", 1, 0, 0, 6, 0, 1, 0
  453. 'AddToTelcoList "MobilCom", "01019", 1, 1, 6, 22, 0, 0, 1
  454. 'AddToTelcoList "MobilCom", "01019", 1, 0, 9, 12, 1, 1, 1
  455.  
  456. End Sub
  457.  
  458. Public Sub ShowOptionsTab()
  459.     Form1.TabStrip1.Tabs(OptionsTab).Selected = True
  460. End Sub
  461.  
  462. Public Sub Status(s As String)
  463.     Form1.StatusBar1.SimpleText = s
  464. End Sub
  465.  
  466.  
  467. Public Sub Dial()
  468.  
  469. Dim TelNr As String
  470. Dim UebergabeStr As String
  471. Dim DialPrefix As String
  472. Dim CompleteDialString As String
  473. Dim DialErr As Boolean
  474. Dim CurrNamListEntry As String
  475. Dim DialType As String
  476. Dim i As Integer
  477. Dim AnrufDistanz As Integer
  478. Dim s As String
  479.  
  480.     'kleine Zugriffshilfe
  481.     CurrNamListEntry = Form1.NamList(Form1.TabStrip1.SelectedItem.Index).List(Form1.NamList(Form1.TabStrip1.SelectedItem.Index).ListIndex)
  482.     TelNr = TelefonNummer(CurrNamListEntry)
  483.     
  484.     'entscheide ob puls oder ton wahl
  485.     If PulsWahl Then DialType = "P" Else DialType = "T"
  486.     
  487.     'DISTANZ des Anrufs bestimmen
  488.     i = Len(LandesKennZahl)
  489.     If i And (Left$(TelNr, i) = LandesKennZahl) Then
  490.         '>>nationaler anruf -> nah oder fern=?
  491.         TelNr = LTrim$(Mid$(TelNr, i + 1))
  492.         i = Len(OrtsKennZahl)
  493.         If i And (Left$(TelNr, i) = OrtsKennZahl) Then
  494.             '>>nahbereich
  495.             TelNr = LTrim$(Mid$(TelNr, i + 1))
  496.             AnrufDistanz = cDistanzNah
  497.         Else
  498.             '>>fernbereich -> bei nationalem Anruf 0 voranstellen?
  499.             If ZeroFlag(CurrNamListEntry) Then TelNr = "0" + TelNr
  500.             AnrufDistanz = cDistanzFern
  501.         End If
  502.     Else
  503.         'INTERnationaler anruf....
  504.         DialPrefix = AuslandPrefix
  505.         'TelNr selbst bleibt
  506.         AnrufDistanz = cDistanzAusland
  507.     End If
  508.     
  509.     'Sind wird in Deutschland? Ja, dann Provider auswΣhlen ->
  510.     If LandesKennZahl = 49 Then
  511.         DialPrefix = BestProvider(WeekDay(Date, vbMonday), Hour(Time), AnrufDistanz) + DialPrefix
  512.     End If
  513.     
  514.     ' weiterleiten? -- aber nur bei TONWAHL  ((hier stand vormals ---;D!,--- ))
  515.     If MacheUebergabe Then If PulsWahl = 0 Then UebergabeStr = ";DP1T" + UebergabeTelNr
  516.     CompleteDialString = "AT" + ZusModemBefehleVorDerWahl + "D" + DialType + AmtPrefix + DialPrefix + TelNr + UebergabeStr + ";H0" + vbCr
  517.     Debug.Print "CompleteDialString="; CompleteDialString
  518.     'jetzt nummer wΣhlen
  519.     On Error GoTo SendComErrHnd
  520.     RcvString = ""
  521.     If Form1.Comm.PortOpen Then Form1.Comm.PortOpen = False
  522.     Form1.Comm.CommPort = CommPortNummer
  523.     Form1.Comm.Settings = "2400,n,8,1"
  524.     Form1.Comm.InputLen = 0
  525.     Form1.Comm.Handshaking = 2
  526.     Form1.Comm.PortOpen = True
  527.     Form1.Comm.Output = CompleteDialString
  528.     
  529.     Form4.Label1(0) = Teilnehmername(CurrNamListEntry)
  530.     s = TelNr
  531.     If AnrufDistanz = cDistanzAusland Then s = "+" + s
  532.     Form4.Label1(1) = s
  533.     ExternalWindowActive = True
  534.     Form4.Show 1
  535.     ExternalWindowActive = False
  536.     
  537. SendExit:
  538.     On Error GoTo 0
  539.     If DialErr Then
  540.         MsgBox "Der angegebene Anschlu▀ COM" + Format$(CommPortNummer) + " ist nicht verfⁿgbar.", 16, Title
  541.         ShowOptionsTab
  542.     End If
  543.     Exit Sub
  544.  
  545. SendComErrHnd:
  546.     DialErr = True
  547.     Resume SendExit
  548.  
  549. End Sub
  550.  
  551. Public Sub DeleteCurrentNameEntry()
  552.     Form1.NamList(Form1.TabStrip1.SelectedItem.Index).RemoveItem Form1.NamList(Form1.TabStrip1.SelectedItem.Index).ListIndex
  553. End Sub
  554.  
  555. Public Sub DeleteCurrentProviderEntry()
  556.     Form1.TelcoList.Sorted = False
  557.     Form1.TelcoList.ListItems.Remove CurrTelcoEntry
  558.     Form1.TelcoList.Sorted = True
  559. End Sub
  560.  
  561. Public Sub DeleteAllProviderEntries()
  562. Dim i As Long
  563.     Form1.TelcoList.Sorted = False
  564.     For i = 1 To Form1.TelcoList.ListItems.Count
  565.         Form1.TelcoList.ListItems.Remove 1
  566.     Next
  567.     Form1.TelcoList.Sorted = True
  568. End Sub
  569.  
  570. Public Sub ActivateTelcoPum()
  571.     With Form1
  572.         CurrTelcoEntry = SelectedItemIndex(.TelcoList)
  573.         .pum3(2).Enabled = CurrTelcoEntry <> 0
  574.         .pum3(3).Enabled = CurrTelcoEntry <> 0
  575.         .PopupMenu .pummain3, , , , .pum3(5)
  576.     End With
  577. End Sub
  578.  
  579. Sub DownloadUpdateFile()
  580. Dim sAnbieter As String
  581. Dim sVorwahl As String
  582. Dim sWerktags As String
  583. Dim sWochenende As String
  584. Dim iAb As Integer
  585. Dim iBis As Integer
  586. Dim sNah As String
  587. Dim sFern As String
  588. Dim sAusland As String
  589. Dim s As String
  590. Dim i As Long
  591. Dim f As Long
  592.  
  593.     Debug.Print "DownloadUpdateFile()"
  594.     Form1.Btn(1).Enabled = False
  595.     Form1.Inet1.AccessType = icDirect
  596.     On Local Error GoTo DlErr
  597.     s = Form1.Inet1.OpenURL(UpdateUrl, icString)
  598.     On Error GoTo 0
  599.     If Not UpdateFailed Then
  600.         For i = 1 To Len(s)
  601.             If Mid$(s, i, 1) = ";" Then Mid$(s, i, 1) = ","
  602.             If Mid$(s, i, 1) = Chr$(34) Then s = Left$(s, i - 1) & Mid$(s, i + 1)
  603.         Next
  604.         
  605.         If Left$(s, Len(UpdateSig)) = UpdateSig Then  '### sig testen
  606.         
  607.             f = FreeFile
  608.             Open UpdateFile For Output As f
  609.             Print #f, s;
  610.             Close f
  611.             MsgBox "▄bertragung beendet - Sie k÷nnen die Verbindung zum Internet jetzt beenden", vbInformation, UpdateTitle
  612.             '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  613.             ' NEUE DATEN EINF▄GEN
  614.             '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  615.             If vbYes = MsgBox("M÷chten Sie Ihre alten Provider-Daten l÷schen?", vbYesNo Or vbDefaultButton2 Or vbQuestion, UpdateTitle) Then DeleteAllProviderEntries
  616.             f = FreeFile
  617.             Open UpdateFile For Input As f
  618.             Line Input #f, s    ' = SIgnature
  619.             Line Input #f, s    ' = TableHeads
  620.             
  621.             On Error Resume Next    'Eventuelle Fehler beim Einlesen ⁿber das Dateiende hinaus brutal unterbinden
  622.             Err = 0
  623.             Do While Not EOF(f) And Err = 0
  624.                 Input #f, sAnbieter, sVorwahl, sWerktags, sWochenende, iAb, iBis, sNah, sFern, sAusland
  625.                 Line Input #f, s 'den Rest der Zeile lesen
  626.                 If Err = 0 Then
  627.                     AddToTelcoList sAnbieter, sVorwahl, Sgn(Len(sWerktags)), Sgn(Len(sWochenende)), iAb, iBis, Sgn(Len(sNah)), Sgn(Len(sFern)), Sgn(Len(sAusland))
  628.                 End If
  629.             Loop
  630.             Close f
  631.             SaveProviderFile
  632.             '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  633.         Else '## sig nicht da?
  634.             MsgBox "Es liegt z.Z. keine gⁿltiges Provider-Update vor - versuchen Sie es bitte spΣter noch einmal." & vbCr & "Sie k÷nnen die Verbindung zum Internet jetzt beenden.", vbExclamation, UpdateTitle
  635.         End If
  636.     End If
  637.     Form1.Btn(1).Enabled = True
  638. Exit Sub
  639.  
  640. '########
  641. DlErr:
  642.     UpdateFailed = True
  643.     MsgBox "Es gab folgerndes Problem:" + vbCr + Err.Description & " (" & Err.Number & ")", vbCritical, UpdateTitle
  644.     Resume Next
  645. End Sub
  646.