Results 1 to 13 of 13

Thread: Caller ID sofware.

  1. #1

    Thread Starter
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Caller ID sofware.

    Hi folks,
    I've recently bought a CallerID device which has a parallel interface.
    With it, it has a piece of source code which i cannot figure out.

    Form1 Code:
    VB Code:
    1. Public port
    2.  
    3. Private Sub Command1_Click()
    4. Close
    5. Open "c:\clid\clid.prt" For Output As #1
    6. If Option1.Value = True Then
    7. Print #1, "1"
    8. Else
    9. Print #1, "2"
    10. End If
    11. End
    12. End Sub
    13.  
    14. Private Sub Command2_Click()
    15. Form1.WindowState = 1
    16. End Sub
    17.  
    18. Private Sub Command3_Click()
    19. If Text1.Text <> "" Then
    20. Open "c:\clid\clid.dat" For Append As #1
    21. Print #1, Text1.Text; Spc(50 - (Len(Text1.Text))); Mid$(List1.List(List1.ListIndex), 11, 10)
    22. Close #1
    23. Label2.Visible = False
    24. Label3.Visible = False
    25. Text1.Visible = False
    26. List1.Visible = True
    27. Command1.Visible = True
    28. Command2.Visible = True
    29. Command3.Visible = False
    30. Text1.Text = ""
    31. End If
    32. End Sub
    33.  
    34. Private Sub Form_Load()
    35. Label2.Visible = False
    36. Label3.Visible = False
    37. Text1.Visible = False
    38. Command3.Visible = False
    39. Open "c:\clid\clid.prt" For Input As #1
    40. Line Input #1, prt$
    41. If prt$ = "1" Then
    42. Option1.Value = True
    43. Else
    44. Option2.Value = True
    45. End If
    46. Close #1
    47. ' This is a sample program. By no means the author can be held responsible
    48. ' for damage caused by this program. By using this program you agree with
    49. ' this terms. USE AT YOUR OWN RISC if your pc will implode or explode your in
    50. ' bad luck ;-)
    51.  
    52. ' Dit is een demonstratie programma. Het gebruik van dit programma is geheel
    53. ' voor EIGEN RISICO.
    54. ' Auteur kan niet aansprakelijk gehouden worden voor schade (van welke aard
    55. ' dan ook ) resulterende uit het gebruik van dit programma. Tevens kan auteur
    56. ' niet aansprakelijk worden gehouden voor fouten in het programma en of
    57. ' door operator gemaakte fouten.
    58. ' Door dit programma te gebruiken stemt U in met deze voorwaarden.
    59.  
    60. ' LET OP : Sluit nooit iets aan op de printerpoort terwijl de pc of het appa-
    61. '          raat wat u wilt aansluiten aanstaat.
    62. valid = 0
    63. Form1.WindowState = 1 'start minimized
    64. 'Print
    65. 'Print "Tijd          Naam                        Nummer"
    66. 'Print "-------------------------------------------------------------------"
    67. Do While True
    68.  
    69.     ' Here the subroutine is called which decodes the values received by the
    70.     ' decoder.
    71.     listen nr$, valid
    72.    
    73.     ' The following code will search a file for the received phonenumber.
    74.     ' If found the number will be dislayed on the screen with the corresponding
    75.     ' name. If not found Onbekend with the received number will be displayed.
    76.     If valid = 1 Then
    77.         Open "c:\clid\clid.dat" For Input As #2
    78.         tmp$ = "begin"
    79.         naam$ = "Onbekend                                          "
    80.  
    81.         Do While Not EOF(2)
    82.             Line Input #2, tmp$
    83.             nrtmp$ = Mid$(tmp$, 51)
    84.            
    85.             'check for -. or space in number
    86.             If InStr(nrtmp$, "-") Then
    87.                 nrtmp1$ = Left$(nrtmp$, (InStr(nrtmp$, "-") - 1))
    88.                 nrtmp1$ = nrtmp1$ + Mid$(nrtmp$, (InStr(nrtmp$, "-") + 1))
    89.                 nrtmp$ = nrtmp1$
    90.             End If
    91.            
    92.             If InStr(nrtmp$, ".") Then
    93.                 nrtmp1$ = Left$(nrtmp$, (InStr(nrtmp$, ".") - 1))
    94.                 nrtmp1$ = nrtmp1$ + Mid$(nrtmp$, (InStr(nrtmp$, ".") + 1))
    95.                 nrtmp$ = nrtmp1$
    96.             End If
    97.            
    98.             If InStr(nrtmp$, " ") Then
    99.                 nrtmp1$ = Left$(nrtmp$, (InStr(nrtmp$, " ") - 1))
    100.                 nrtmp1$ = nrtmp1$ + Mid$(nrtmp$, (InStr(nrtmp$, " ") + 1))
    101.                 nrtmp$ = nrtmp1$
    102.             End If
    103.            
    104.             If InStr(nrtmp$, nr$) Then
    105.                 naam$ = Left$(tmp$, 50)
    106.             End If
    107.         Loop
    108.  
    109.     Close #2
    110.  
    111.     List1.AddItem (Time$ & "  " & nr$ & "  " & naam$), 0
    112.     valid = 0
    113.     mstmp$ = Time$ & "  " & nr$ & "  " & naam$
    114.     Form1.WindowState = 2
    115.     Form1.Show
    116.     Open "c:\clid\clid.log" For Append As #2
    117.     Print #2, Date$ & " " & Time$ & "  " & nr$ & "  " & naam$
    118.     Close #2
    119.     End If
    120. Loop
    121. End Sub
    122.  
    123. Static Sub listen(nr$, valid)
    124. Static btime
    125. nr$ = ""
    126. Form1.Show
    127. i = Inp(port) '379 for lpt1 279 for lpt2
    128. Do While (i And 64) = 64 'While STD is high read decoded DTMF signal
    129. i = Inp(port)
    130. DoEvents
    131. Loop
    132. valid = 0 ' Indicator for receiving a complete number.
    133. ' A complete number begins with a 'D' then the numerals and ends with a 'C'
    134. If (i And 184) = &H8 Then a$ = a$ + "9"
    135. If (i And 184) = &H10 Then a$ = a$ + "0"
    136. If (i And 184) = &H18 Then a$ = a$ + "*"
    137. If (i And 184) = &H20 Then a$ = a$ + "#"
    138. If (i And 184) = &H28 Then
    139. a$ = ""
    140. btime = Now 'a$ + "A"
    141. End If
    142. If (i And 184) = &H30 Then
    143. a$ = ""
    144. btime = Now 'a$ + "B"
    145. End If
    146. If (i And 184) = &H80 Then
    147. a$ = ""
    148. btime = Now ' A 'D' was received. Clear nr$ for reception of new number
    149. End If
    150. If (i And 184) = &H88 Then a$ = a$ + "1"
    151. If (i And 184) = &H90 Then a$ = a$ + "2"
    152. If (i And 184) = &H98 Then a$ = a$ + "3"
    153. If (i And 184) = &HA0 Then a$ = a$ + "4"
    154. If (i And 184) = &HA8 Then a$ = a$ + "5"
    155. If (i And 184) = &HB0 Then a$ = a$ + "6"
    156. If (i And 184) = &HB8 Then a$ = a$ + "7"
    157. If (i And 184) = &H0 Then a$ = a$ + "8"
    158. Do While (i And 64) = 0 'While no new data wait (STD==LOW)
    159. i = Inp(port)
    160. DoEvents
    161. Loop
    162.  
    163. If (i And 184) = &H38 Then
    164. ' A 'C' is received. The number is complete and
    165. ' will be returned to the calling application.
    166. If DateDiff("s", btime, Now) <= 3 Then ' is het nummer binnen 2 sec ontvangen ?
    167. nr$ = a$
    168. a$ = ""
    169. valid = 1
    170. Exit Sub
    171. Else
    172. nr$ = ""
    173. a$ = ""
    174. End If
    175. End If
    176. End Sub
    177.  
    178. Private Sub List1_DblClick()
    179. List1.Visible = False
    180. Command1.Visible = False
    181. Command2.Visible = False
    182. Label2.Visible = True
    183. Text1.Visible = True
    184. Text1.SetFocus
    185. Label3.Visible = True
    186. Command3.Visible = True
    187. End Sub
    188.  
    189. Private Sub Option1_Click()
    190. port = &H379
    191. End Sub
    192.  
    193. Private Sub Option2_Click()
    194. port = &H279
    195. End Sub
    196.  
    197. Private Sub Text1_KeyPress(KeyAscii As Integer)
    198. If KeyAscii = 13 Then
    199. Command3.Value = True
    200. End If
    201. End Sub

    Module Code:
    VB Code:
    1. 'Declare Inp and Out for port I/O
    2. Public Declare Function Inp Lib "inpout32.dll" _
    3. Alias "Inp32" (ByVal PortAddress As Integer) As Byte
    4. Public Declare Sub Out Lib "inpout32.dll" _
    5. Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Byte)


    From this code i tried to make an ActiveX dll for integration within my application. There i need one function that continously checks if there is a new phonenumber available.

    I made a class TAPI:
    VB Code:
    1. Option Explicit
    2.  
    3. Private A As String
    4. Private mvarTelNr As String
    5. Private mvarTime As String
    6.  
    7. Private Function PhoneListen() As Boolean
    8.     Static bTime As String
    9.    
    10.     mvarTelNr = ""
    11.     i = Inp(Port) 'LPT1 = 379, LPT2 = 279
    12.    
    13.     Do While (i And 64) = 64
    14.         i = Inp(Port)
    15.         DoEvents
    16.     Loop
    17.    
    18.     PhoneListen = False
    19.    
    20.     If (i And 184) = &H8 Then A = A & "9"
    21.     If (i And 184) = &H10 Then A = A & "0"
    22.     If (i And 184) = &H18 Then A = A & "*"
    23.     If (i And 184) = &H20 Then A = A & "#"
    24.    
    25.     If (i And 184) = &H28 Then
    26.         mvarTelNr = ""
    27.         i = Inp(Port)
    28.         Do While (i And 64) = 64
    29.             i = Inp(Port)
    30.             DoEvents
    31.         Loop
    32.        
    33.         PhoneListen = False
    34.  
    35.         ' A complete number begins with a 'D' then the numerals and ends with a 'C'
    36.         If (i And 184) = &H8 Then A = A & "9"
    37.         If (i And 184) = &H10 Then A = A & "0"
    38.         If (i And 184) = &H18 Then A = A & "*"
    39.         If (i And 184) = &H20 Then A = A & "#"
    40.        
    41.         If (i And 184) = &H28 Then
    42.             A = ""
    43.             bTime = Now()
    44.         End If
    45.        
    46.         If (i And 184) = &H30 Then
    47.             A = ""
    48.             bTime = Now()
    49.         End If
    50.        
    51.         If (i And 184) = &H80 Then
    52.             A = ""
    53.             bTime = Now() ' A 'D' was received. Clear nr$ for reception of new number
    54.         End If
    55.        
    56.         If (i And 184) = &H88 Then A = A & "1"
    57.         If (i And 184) = &H90 Then A = A & "2"
    58.         If (i And 184) = &H98 Then A = A & "3"
    59.         If (i And 184) = &HA0 Then A = A & "4"
    60.         If (i And 184) = &HA8 Then A = A & "5"
    61.         If (i And 184) = &HB0 Then A = A & "6"
    62.         If (i And 184) = &HB8 Then A = A & "7"
    63.         If (i And 184) = &H0 Then A = A & "8"
    64.        
    65.         Do While (i And 64) = 0 'While no new data wait (STD==LOW)
    66.             i = Inp(Port)
    67.             DoEvents
    68.         Loop
    69.  
    70.         If (i And 184) = &H38 Then
    71.             ' A 'C' is received. The number is complete and
    72.             ' will be returned to the calling application.
    73.             If DateDiff("s", bTime, Now) <= 3 Then ' is het nummer binnen 2 sec ontvangen ?
    74.                 mvarTelNr = A
    75.                 PhoneListen = True
    76.                 Exit Function
    77.             Else
    78.                 mvarTelNr = ""
    79.                 A = ""
    80.             End If
    81.         End If
    82.     End If
    83. End Function
    84.  
    85. Public Function GetPhoneNumber() As String
    86.     Dim NrTmp As String
    87.    
    88.     Do While PhoneListen = True
    89.         NrTmp = Trim(mvarTelNr)
    90.        
    91.         If InStr(NrTmp, "-") Then
    92.             NrTmp = Left$(NrTmp, (InStr(NrTmp, "-") - 1)) & Mid$(NrTmp, (InStr(NrTmp, "-") + 1))
    93.         End If
    94.        
    95.         If InStr(NrTmp, ".") Then
    96.             NrTmp = Left$(NrTmp, (InStr(NrTmp, ".") - 1)) & Mid$(NrTmp, (InStr(NrTmp, ".") + 1))
    97.         End If
    98.        
    99.         If InStr(NrTmp, " ") Then
    100.             NrTmp = Left$(NrTmp, (InStr(NrTmp, " ") - 1)) & Mid$(NrTmp, (InStr(NrTmp, " ") + 1))
    101.         End If
    102.     Loop
    103. End Function

    and a global module:
    VB Code:
    1. Option Explicit
    2.  
    3. Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Byte
    4. Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Byte)

    Who can help me with finishing this piece? because i can't see exactly what the original code do. I is a little bit bad programming i guess.
    Better to regret things you did, than those you didn't
    International Intelligence

  2. #2

    Thread Starter
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Re: Caller ID sofware.

    Can somebody solve this???
    Better to regret things you did, than those you didn't
    International Intelligence

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Caller ID sofware.

    Does the sample program work without any hardware glitches?

  4. #4

    Thread Starter
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Re: Caller ID sofware.

    Quote Originally Posted by dglienna
    Does the sample program work without any hardware glitches?
    What do you mean? I forgot to mention that an additional dll is loaded for the port communication.
    If i try to run his version i get a lot of declaration errors. Also i cannot find the right structure to convert it.
    Better to regret things you did, than those you didn't
    International Intelligence

  5. #5
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Caller ID sofware.

    Exactly what errors do you get and on what line?
    Since we don't have the device or dlls we can't run it ourselves.

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Caller ID sofware.

    It would be best if you could upload complete project files here so we can examin it.

  7. #7
    Addicted Member VbMafia's Avatar
    Join Date
    Sep 2004
    Location
    Pilipinas
    Posts
    177

    Re: Caller ID sofware.

    There something happen you need some OCX to use in your program..
    " I never did anything worth doing entirely by accident.... Almost none of my inventions were derived in that manner. They were achieved by having trained myself to be analytical and to endure and tolerate hard work."

    " Many of life's failures are experienced by people who did not realize how close they were to success when they gave up. "
    - Thomas Alva Edison-

    In God We Trust

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Caller ID sofware.

    You should upload the documentation, also. If it's a hardware device, it won't work without the driver/dll/ocx. Something may have to be registered, or parameters loaded to signify the correct address.

  9. #9

    Thread Starter
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Re: Caller ID sofware.

    Here is the sourcecode complete with the documentation.
    Better to regret things you did, than those you didn't
    International Intelligence

  10. #10
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Caller ID sofware.

    Do you have documentation for the hardware device?
    Also as asked before, does the sample program work OK?
    Last edited by moeur; Apr 6th, 2005 at 09:56 AM.

  11. #11

    Thread Starter
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Re: Caller ID sofware.

    Sorry for my delayed answer.
    Here it is. (translated from Dutch with http://ets.freetranslation.com)

    Description of the Caller-ID Decode / Software.

    The program may spread become free and possibly adapted become to your wish.

    Conditions:

    The conditions of this program is, that you WINDOWS95 or 98 use, and that you more than 8mb internal memory has. The program
    uses approximately 5mb at diskruimte.

    By the connecting and / or use by these decode, serve the legal provisions in eight to be taken.

    Suppliers accepted no single liability for damage (of which nature then also) arise through the use of the decode and / or software. Through these and / or software am using, votes you in with these conditions.

    Installation of the hardware:

    Remove your pc, and close the decode at on a going out LPT-Gate (printer gate). You have going out can no printer gate, you these there then us against a small compensation verkrijgen.

    Connects the decode on the telephone line.











    Installation of the software:

    The installation of this program is very simple.

    Start WINDOWS95 or 98. Place the cdrom in the cd-skim station Press on START-EXPORT, and typ in d:\setup.exe (as a D:\
    your cdrom player is)

    The setup program begins now.

    The program makes by itself an icon in START-PROGRAM' S-number reproduction

    If about it asked becomes the pc again to start, do this then.


    Program explanation:

    If you the program have opgestart, then appeared this under in the task beam of Windows. If you at the bottom of the task beam on CLID click, becomes the screen increased reproduced. Duplicate click now on the blue beam of the screen in which state “number reproduction”.

    You can choose now for the LPT-Gate, on which the CLID connected Decode stands-. This need you only once to do. (standard is this LPT-2)

    Busily now on the test “reduce” the program to minimize. This is the position in which the program asset is and you attendeert on coming in calls.

    When it a call comes, will the program forth come and the phone number of the beller and possibly all imported name let see.

    Stands there yet no name by the phone number, duplicate click then on the rule in which the number stands. You become now asked a name in to types that by the phone number hears. The next time that this person you ring, will the name by the number appeared.





    Address books make:

    It is to be changed possible with a text-editor (for instance notepad of Windows) the address book with the hand.

    Loan on that the phone number on the 51ste position must begin. Each name begins on a new rule.

    The resistant goods the names with the phone numbers in stand hot CLID. THAT and is, to find in the directory C: \Program
    Files\Project1.

    You can have for instance all your knowledges or family members meanwhile in the resistant imports. Then can you at the same time see who there rings.
    Better to regret things you did, than those you didn't
    International Intelligence

  12. #12

    Thread Starter
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Re: Caller ID sofware.

    kick post
    Better to regret things you did, than those you didn't
    International Intelligence

  13. #13
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Caller ID sofware.

    Quote Originally Posted by hassa046
    What do you mean? I forgot to mention that an additional dll is loaded for the port communication.
    If i try to run his version i get a lot of declaration errors. Also i cannot find the right structure to convert it.

    Did you change the properties so that the program is run as w95 or w98?
    That might make a difference, as long as the program doesn't try to access protected memory that is protected in XP.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width