|
-
Apr 4th, 2005, 07:31 AM
#1
Thread Starter
Hyperactive Member
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:
Public port
Private Sub Command1_Click()
Close
Open "c:\clid\clid.prt" For Output As #1
If Option1.Value = True Then
Print #1, "1"
Else
Print #1, "2"
End If
End
End Sub
Private Sub Command2_Click()
Form1.WindowState = 1
End Sub
Private Sub Command3_Click()
If Text1.Text <> "" Then
Open "c:\clid\clid.dat" For Append As #1
Print #1, Text1.Text; Spc(50 - (Len(Text1.Text))); Mid$(List1.List(List1.ListIndex), 11, 10)
Close #1
Label2.Visible = False
Label3.Visible = False
Text1.Visible = False
List1.Visible = True
Command1.Visible = True
Command2.Visible = True
Command3.Visible = False
Text1.Text = ""
End If
End Sub
Private Sub Form_Load()
Label2.Visible = False
Label3.Visible = False
Text1.Visible = False
Command3.Visible = False
Open "c:\clid\clid.prt" For Input As #1
Line Input #1, prt$
If prt$ = "1" Then
Option1.Value = True
Else
Option2.Value = True
End If
Close #1
' This is a sample program. By no means the author can be held responsible
' for damage caused by this program. By using this program you agree with
' this terms. USE AT YOUR OWN RISC if your pc will implode or explode your in
' bad luck ;-)
' Dit is een demonstratie programma. Het gebruik van dit programma is geheel
' voor EIGEN RISICO.
' Auteur kan niet aansprakelijk gehouden worden voor schade (van welke aard
' dan ook ) resulterende uit het gebruik van dit programma. Tevens kan auteur
' niet aansprakelijk worden gehouden voor fouten in het programma en of
' door operator gemaakte fouten.
' Door dit programma te gebruiken stemt U in met deze voorwaarden.
' LET OP : Sluit nooit iets aan op de printerpoort terwijl de pc of het appa-
' raat wat u wilt aansluiten aanstaat.
valid = 0
Form1.WindowState = 1 'start minimized
'Print
'Print "Tijd Naam Nummer"
'Print "-------------------------------------------------------------------"
Do While True
' Here the subroutine is called which decodes the values received by the
' decoder.
listen nr$, valid
' The following code will search a file for the received phonenumber.
' If found the number will be dislayed on the screen with the corresponding
' name. If not found Onbekend with the received number will be displayed.
If valid = 1 Then
Open "c:\clid\clid.dat" For Input As #2
tmp$ = "begin"
naam$ = "Onbekend "
Do While Not EOF(2)
Line Input #2, tmp$
nrtmp$ = Mid$(tmp$, 51)
'check for -. or space in number
If InStr(nrtmp$, "-") Then
nrtmp1$ = Left$(nrtmp$, (InStr(nrtmp$, "-") - 1))
nrtmp1$ = nrtmp1$ + Mid$(nrtmp$, (InStr(nrtmp$, "-") + 1))
nrtmp$ = nrtmp1$
End If
If InStr(nrtmp$, ".") Then
nrtmp1$ = Left$(nrtmp$, (InStr(nrtmp$, ".") - 1))
nrtmp1$ = nrtmp1$ + Mid$(nrtmp$, (InStr(nrtmp$, ".") + 1))
nrtmp$ = nrtmp1$
End If
If InStr(nrtmp$, " ") Then
nrtmp1$ = Left$(nrtmp$, (InStr(nrtmp$, " ") - 1))
nrtmp1$ = nrtmp1$ + Mid$(nrtmp$, (InStr(nrtmp$, " ") + 1))
nrtmp$ = nrtmp1$
End If
If InStr(nrtmp$, nr$) Then
naam$ = Left$(tmp$, 50)
End If
Loop
Close #2
List1.AddItem (Time$ & " " & nr$ & " " & naam$), 0
valid = 0
mstmp$ = Time$ & " " & nr$ & " " & naam$
Form1.WindowState = 2
Form1.Show
Open "c:\clid\clid.log" For Append As #2
Print #2, Date$ & " " & Time$ & " " & nr$ & " " & naam$
Close #2
End If
Loop
End Sub
Static Sub listen(nr$, valid)
Static btime
nr$ = ""
Form1.Show
i = Inp(port) '379 for lpt1 279 for lpt2
Do While (i And 64) = 64 'While STD is high read decoded DTMF signal
i = Inp(port)
DoEvents
Loop
valid = 0 ' Indicator for receiving a complete number.
' A complete number begins with a 'D' then the numerals and ends with a 'C'
If (i And 184) = &H8 Then a$ = a$ + "9"
If (i And 184) = &H10 Then a$ = a$ + "0"
If (i And 184) = &H18 Then a$ = a$ + "*"
If (i And 184) = &H20 Then a$ = a$ + "#"
If (i And 184) = &H28 Then
a$ = ""
btime = Now 'a$ + "A"
End If
If (i And 184) = &H30 Then
a$ = ""
btime = Now 'a$ + "B"
End If
If (i And 184) = &H80 Then
a$ = ""
btime = Now ' A 'D' was received. Clear nr$ for reception of new number
End If
If (i And 184) = &H88 Then a$ = a$ + "1"
If (i And 184) = &H90 Then a$ = a$ + "2"
If (i And 184) = &H98 Then a$ = a$ + "3"
If (i And 184) = &HA0 Then a$ = a$ + "4"
If (i And 184) = &HA8 Then a$ = a$ + "5"
If (i And 184) = &HB0 Then a$ = a$ + "6"
If (i And 184) = &HB8 Then a$ = a$ + "7"
If (i And 184) = &H0 Then a$ = a$ + "8"
Do While (i And 64) = 0 'While no new data wait (STD==LOW)
i = Inp(port)
DoEvents
Loop
If (i And 184) = &H38 Then
' A 'C' is received. The number is complete and
' will be returned to the calling application.
If DateDiff("s", btime, Now) <= 3 Then ' is het nummer binnen 2 sec ontvangen ?
nr$ = a$
a$ = ""
valid = 1
Exit Sub
Else
nr$ = ""
a$ = ""
End If
End If
End Sub
Private Sub List1_DblClick()
List1.Visible = False
Command1.Visible = False
Command2.Visible = False
Label2.Visible = True
Text1.Visible = True
Text1.SetFocus
Label3.Visible = True
Command3.Visible = True
End Sub
Private Sub Option1_Click()
port = &H379
End Sub
Private Sub Option2_Click()
port = &H279
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command3.Value = True
End If
End Sub
Module Code:
VB Code:
'Declare Inp and Out for port I/O
Public Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Byte
Public Declare Sub Out Lib "inpout32.dll" _
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:
Option Explicit
Private A As String
Private mvarTelNr As String
Private mvarTime As String
Private Function PhoneListen() As Boolean
Static bTime As String
mvarTelNr = ""
i = Inp(Port) 'LPT1 = 379, LPT2 = 279
Do While (i And 64) = 64
i = Inp(Port)
DoEvents
Loop
PhoneListen = False
If (i And 184) = &H8 Then A = A & "9"
If (i And 184) = &H10 Then A = A & "0"
If (i And 184) = &H18 Then A = A & "*"
If (i And 184) = &H20 Then A = A & "#"
If (i And 184) = &H28 Then
mvarTelNr = ""
i = Inp(Port)
Do While (i And 64) = 64
i = Inp(Port)
DoEvents
Loop
PhoneListen = False
' A complete number begins with a 'D' then the numerals and ends with a 'C'
If (i And 184) = &H8 Then A = A & "9"
If (i And 184) = &H10 Then A = A & "0"
If (i And 184) = &H18 Then A = A & "*"
If (i And 184) = &H20 Then A = A & "#"
If (i And 184) = &H28 Then
A = ""
bTime = Now()
End If
If (i And 184) = &H30 Then
A = ""
bTime = Now()
End If
If (i And 184) = &H80 Then
A = ""
bTime = Now() ' A 'D' was received. Clear nr$ for reception of new number
End If
If (i And 184) = &H88 Then A = A & "1"
If (i And 184) = &H90 Then A = A & "2"
If (i And 184) = &H98 Then A = A & "3"
If (i And 184) = &HA0 Then A = A & "4"
If (i And 184) = &HA8 Then A = A & "5"
If (i And 184) = &HB0 Then A = A & "6"
If (i And 184) = &HB8 Then A = A & "7"
If (i And 184) = &H0 Then A = A & "8"
Do While (i And 64) = 0 'While no new data wait (STD==LOW)
i = Inp(Port)
DoEvents
Loop
If (i And 184) = &H38 Then
' A 'C' is received. The number is complete and
' will be returned to the calling application.
If DateDiff("s", bTime, Now) <= 3 Then ' is het nummer binnen 2 sec ontvangen ?
mvarTelNr = A
PhoneListen = True
Exit Function
Else
mvarTelNr = ""
A = ""
End If
End If
End If
End Function
Public Function GetPhoneNumber() As String
Dim NrTmp As String
Do While PhoneListen = True
NrTmp = Trim(mvarTelNr)
If InStr(NrTmp, "-") Then
NrTmp = Left$(NrTmp, (InStr(NrTmp, "-") - 1)) & Mid$(NrTmp, (InStr(NrTmp, "-") + 1))
End If
If InStr(NrTmp, ".") Then
NrTmp = Left$(NrTmp, (InStr(NrTmp, ".") - 1)) & Mid$(NrTmp, (InStr(NrTmp, ".") + 1))
End If
If InStr(NrTmp, " ") Then
NrTmp = Left$(NrTmp, (InStr(NrTmp, " ") - 1)) & Mid$(NrTmp, (InStr(NrTmp, " ") + 1))
End If
Loop
End Function
and a global module:
VB Code:
Option Explicit
Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Byte
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.
-
Apr 4th, 2005, 12:43 PM
#2
Thread Starter
Hyperactive Member
Re: Caller ID sofware.
Can somebody solve this???
-
Apr 4th, 2005, 01:02 PM
#3
Re: Caller ID sofware.
Does the sample program work without any hardware glitches?
-
Apr 4th, 2005, 04:40 PM
#4
Thread Starter
Hyperactive Member
Re: Caller ID sofware.
 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.
-
Apr 4th, 2005, 05:29 PM
#5
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.
-
Apr 5th, 2005, 02:16 AM
#6
Re: Caller ID sofware.
It would be best if you could upload complete project files here so we can examin it.
-
Apr 5th, 2005, 02:25 AM
#7
Addicted Member
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 
-
Apr 5th, 2005, 02:41 AM
#8
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.
-
Apr 6th, 2005, 05:08 AM
#9
Thread Starter
Hyperactive Member
Re: Caller ID sofware.
Here is the sourcecode complete with the documentation.
-
Apr 6th, 2005, 09:52 AM
#10
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.
-
Apr 7th, 2005, 04:23 PM
#11
Thread Starter
Hyperactive Member
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.
-
Apr 8th, 2005, 08:26 AM
#12
Thread Starter
Hyperactive Member
-
Apr 8th, 2005, 08:56 AM
#13
Re: Caller ID sofware.
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|