Mã nguồn của ActiveX Control (part 3)
danhso = False End If Exit Sub End If If tbnhap.Text = "On." Then setupfixed = True tbnhap.Text = "Completed" phonebook = False Exit Sub End If If tbnhap.Text = ...
danhso = False
End If
Exit Sub
End If
If tbnhap.Text = "On." Then
setupfixed = True
tbnhap.Text = "Completed"
phonebook = False
Exit Sub
End If
If tbnhap.Text = "Off." Then
setupfixed = False
tbnhap.Text = "Completed"
phonebook = False
Exit Sub
End If
If tbnhap.Text = "Edit Entry" Then
Call fixeddiallist
editentrylist = True
cancle = False
Exit Sub
End If
If editentrylist = True Then
tbnhap.Text = "Change Name" & vbCrLf
cancle = False
danhso = False
changecase = True
listdial = False
phonebook = False
Exit Sub
End If
If tbnhap.Text = " Add Entry" Then
tbnhap.Text = "Enter Name?" & vbCrLf
cancle = False
danhso = False
addentrylist = True
swit = True
phonebook = False
Exit Sub
End If
If tbnhap.Text = "Erase Entry" Then
Call fixeddiallist
eraseentrylist = True
Exit Sub
End If
If eraseentrylist = True Then
Call erased(vitri)
listdial = False
phonebook = False
Exit Sub
End If
'xu ly cua muc One-Touch Dial Setting
If tbnhap.Text = "One-Touch Dial Setting" Then
tbnhap.Text = " To Phone Memory"
Exit Sub
End If
If tbnhap.Text = " To Phone Memory" Then
tbnhap.Text = "Completed"
onetouchphone = True
onetouchof = 1
Exit Sub
End If
If tbnhap.Text = " To SIM Memory" Then
tbnhap.Text = "Completed"
onetouchof = 2
onetouchphone = True
Exit Sub
End If
If tbnhap.Text = " To Fixed Dial List" Then
tbnhap.Text = "Completed"
onetouchphone = True
onetouchof = 3
Exit Sub
End If
'xu ly cua menu Call Related Features
If tbnhap.Text = "Call Related Features" Then
tbnhap.Text = "Show Battery Meter"
features = True
Exit Sub
End If
If tbnhap.Text = "Restrict My Phone Number" Then
tbnhap.Text = "Show ID On Next Call"
Exit Sub
End If
If tbnhap.Text = "Call Diverting" Then
tbnhap.Text = "Divert Voice Calls"
Exit Sub
End If
If tbnhap.Text = "Divert Voice Calls" Then
tbnhap.Text = "Divert When Unavailable"
Exit Sub
End If
If tbnhap.Text = "Divert When Unavailable" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Divert All Voice Calls" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Detailed Diverting" Then
tbnhap.Text = "If Busy"
Exit Sub
End If
If tbnhap.Text = "If Busy" Or tbnhap.Text = "If Not Reachable" Or tbnhap.Text = "If No Answer" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Divert Fax Calls" Or tbnhap.Text = "Divert Data Calls" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Talk and Fax" Or tbnhap.Text = "Call Waiting" Or tbnhap.Text = "Key Answer Only" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Call Barring" Then
tbnhap.Text = "Enter Barring Password" & vbCrLf
danhso = True
cancle = True
features = False
Exit Sub
End If
If Left(tbnhap.Text, 13) = "Enter Barring" Then
k = InStr(tbnhap.Text, vbLf)
st = Mid(tbnhap.Text, k + 1)
If st = barpassword Then
tbnhap.Text = "Bar Outgoing Calls"
features = True
danhso = False
cancle = True
Else
tbnhap.Text = " Not Match."
danhso = False
End If
Exit Sub
End If
If tbnhap.Text = "Bar Outgoing Calls" Then
tbnhap.Text = "Int'l Calls"
Exit Sub
End If
If tbnhap.Text = "Bar Incoming Calls" Then
tbnhap.Text = "When Roaming"
Exit Sub
End If
'xu ly cua phan change bar password
If tbnhap.Text = "Change Bar Password" Then
tbnhap.Text = " Current Password" & vbCrLf
features = False
danhso = True
setup = False
Exit Sub
End If
If Left(tbnhap.Text, 17) = " Current Password" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = barpassword Then
tbnhap.Text = "New Barring Password" & vbCrLf
danhso = True
cancle = True
Else
tbnhap.Text = "Invalid Password"
danhso = False
cancle = True
End If
Exit Sub
End If
If Left(tbnhap.Text, 20) = "New Barring Password" Then
k = InStr(tbnhap.Text, vbLf)
If Len(Mid(tbnhap.Text, k + 1)) <> 4 Then
tbnhap.Text = " Enter 4 Digit"
danhso = False
Else
barpassword = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
End If
Exit Sub
End If
'vao menu con cua muc Show Battery Meter
If volume.Visible = True Then
volume.Visible = False
tbnhap.Visible = True
Frame1.Height = 500
Frame1.Width = 1800
tbnhap.Text = "Menu"
Exit Sub
End If
If tbnhap.Text = "Show Battery Meter" Or (luumuc = 11 And quickaccess = True And longpress = False) Then
volume.Visible = True
tbnhap.Visible = False
Frame1.Height = 240
Frame1.Width = 1800
volume.Picture = battery.Picture
cancle = True
danhso = False
quickaccess = False
features = False
luumuc = 0
Exit Sub
End If
'phan xu ly cua menu restrict my phone number
If tbnhap.Text = "Show ID On Next Call" Or tbnhap.Text = "Restrict ID On Next Call" Or tbnhap.Text = "Cancle All Diverting" Then
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
'xu ly cua phan call barring
If tbnhap.Text = "Int'l Calls" Or tbnhap.Text = "Int'l Calls Except Home" Then
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
If tbnhap.Text = "All Calls" Then
callbarring = True
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
If tbnhap.Text = "Off?" Then
callbarring = False
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
'xu ly cua phan Bar Incoming Calls
If tbnhap.Text = "When Roaming" Or tbnhap.Text = " All Calls" Or tbnhap.Text = "Off? " Then
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
If tbnhap.Text = "Cancel All Barring" Then
callbarring = False
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
'vao phan xu ly cua menu Messages
If tbnhap.Text = "Messages" Then
tbnhap.Text = "Call Voicemail"
message1 = True
Exit Sub
End If
'phan xu ly trong muc Message Editor
If tbnhap.Text = "Message Editor" Or (luumuc = 15 And quickaccess = True) Then
taomoi = False
quickaccess = False
luumuc = 0
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) Len(message)
If banghi = 0 Then
tbnhap.Text = ""
editor = True
danhso = False
cancle = False
message1 = False
Else
Get #1, banghi, message
tbnhap.Text = Trim(message.tin)
messagenumber = banghi
editor = True
danhso = False
cancle = False
message1 = False
End If
Close #1
Exit Sub
End If
If editor = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
st = tbnhap.Text
tbnhap.Text = " Send Message"
editor = False
cancle = True
danhso = False
End If
Exit Sub
End If
If tbnhap.Text = "Cell Broadcast" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Message Settings" Then
tbnhap.Text = "Voicemail Number"
Exit Sub
End If
If tbnhap.Text = "Outgoing Message Type" Then
tbnhap.Text = "Text"
Exit Sub
End If
'phan xu ly cua menu Outgoing Message
If tbnhap.Text = "Outgoing Messages" Or tbnhap.Text = "Outgoing SMS?" Then '(luumuc = 14 And quickaccess = True) Then
messagelist = True
quickaccess = False
thu = False
luumuc = 0
cancle = False
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) Len(message)
If banghi = 0 Then
tbnhap.Text = "No Message Stored"
messagelist = False
Else
Get #1, 1, message
tbnhap.Text = Trim(message.tin)
messagenumber = 1
'cancle = True
danhso = False
End If
Close #1
Exit Sub
End If
If messagelist = True Then
tbnhap.Text = "Send Message"
messagelist = False
Exit Sub
End If
If tbnhap.Text = "Send Message" Or tbnhap.Text = " Send Message" Then
tbnhap.Text = " Enter Number"
danhso = False
cancle = True
message1 = True
Exit Sub
End If
If tbnhap.Text = " Enter Number" Then
tbnhap.Text = ""
message1 = False
danhso = True
cancle = True
send = True
Exit Sub
End If
If sending = True Then
If tbnhap.Text = "" Then
sending = False
Exit Sub
End If
messagelist = False
sending = False
tbnhap.Text = "Sending"
message1 = False
flag = False
menucon = False
Exit Sub
End If
'phan xu ly cua muc Edit Message
If tbnhap.Text = "Edit Message" Then
taomoi = False
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) Len(message)
Get #1, messagenumber, message
tbnhap.Text = Trim(message.tin)
danhso = False
cancle = False
editor = True
message1 = False
Close #1
Exit Sub
End If
'phan xu ly cua muc Store Message
If tbnhap.Text = "Store Message" Then
Call store_message
message1 = False
Exit Sub
End If
'phan xu ly cua muc delete message trong Outgoing Message
If tbnhap.Text = "Delete Message" Then
Call delete_message
message1 = False
danhso = False
cancle = True
Exit Sub
End If
'xu ly cua muc Go to next Message trong Outgoing Message
If tbnhap.Text = "Go to Next Message" Then
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) Len(message)
If banghi <= messagenumber Then
Get #1, 1, message
tbnhap.Text = Trim(message.tin)
Else
messagenumber = messagenumber + 1
Get #1, messagenumber, message
tbnhap.Text = Trim(message.tin)
End If
messagelist = True
Close #1
Exit Sub
End If
'xu ly khi gap truong hop No Msg Stored
If tbnhap.Text = "No Message Stored" Then
message1 = False
tbnhap.Text = "Menu"
danhso = True
cancle = True
Exit Sub
End If
'vao trong muc voicemail number cua message setting
If tbnhap.Text = "Voicemail Number" Then
tbnhap.Text = voicemailnumber
danhso = True
cancle = True
setting = True
message1 = False
voice = True
Exit Sub
End If
If voice = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
voicemailnumber = tbnhap.Text
voice = False
tbnhap.Text = "Completed"
danhso = False
cancle = True
setting = False
Exit Sub
End If
End If
'vao trong muc Service Centre cua message setting
If tbnhap.Text = "Service Centre" Then
tbnhap.Text = servicecentre
danhso = True
cancle = True
setting = True
service = True
message1 = False
Exit Sub
End If
If service = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
servicecentre = tbnhap.Text
service = False
tbnhap.Text = "Completed"
danhso = False
setting = False
Exit Sub
End If
End If
'vao trong muc Expiry Period cua message setting
If tbnhap.Text = "Expiry Period" Then
tbnhap.Text = expiryperiod
danhso = True
cancle = True
setting = True
message1 = False
expiry = True
Exit Sub
End If
If expiry = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
expiryperiod = tbnhap.Text
expiry = False
tbnhap.Text = "Completed"
danhso = False
setting = False
Exit Sub
End If
End If
'xu ly cua phan Call Voicemail
If tbnhap.Text = "Call Voicemail" Or (luumuc = 12 And quickaccess = True) Then
If longpress = True Then
Exit Sub
End If
tbnhap.Text = "Calling"
danhso = False
cancle = True
Image2.Visible = True
message1 = False
quickaccess = False
luumuc = 0
Exit Sub
End If
'******** vao menu con cua muc Phone Setup ********
If tbnhap.Text = "Phone Setup" Then
tbnhap.Text = "Select Phone Line"
setup = True
Exit Sub
End If
'vao menu con cua muc Select phone line
If tbnhap.Text = "Select Phone Line" Or (luumuc = 7 And quickaccess = True) Then 'longpress = False) Then
quickaccess = False
luumuc = 0
tbnhap.Text = "Line 1"
danhso = False
cancle = True
Exit Sub
End If
If tbnhap.Text = "Line 1" Then
tbnhap.Text = "Completed"
line2 = False
setup = False
Exit Sub
End If
If tbnhap.Text = "Line 2" Then
tbnhap.Text = "Completed"
quickaccess = False
line2 = True
setup = False
Exit Sub
End If
'vao menu con cua muc Adjust Ring Volume
If volume.Visible = True Then 'And so(14).Value = False And so(15).Value = False Then
volume.Visible = False
tbnhap.Visible = True
Frame1.Height = 500
Frame1.Width = 1800
tbnhap.Text = "Menu"
advolume = False
setup = False
Exit Sub
End If
If (tbnhap.Text = "Adjust Ring Volume" And setup = True) Or (luumuc = 6 And quickaccess = True) Then 'longpress = False) Then
volume.Visible = True
tbnhap.Visible = False
Frame1.Height = 240
Frame1.Width = 1790
volume.Picture = volume1(vol).Picture
advolume = True
setup = False
cancle = True
danhso = False
quickaccess = False
luumuc = 0
Exit Sub
End If
'vao menu con cua muc Ring or vibrate
If tbnhap.Text = "Ring or Vibrate" Then
tbnhap.Text = "Ring Only"
Exit Sub
End If
If luumuc = 9 And quickaccess = True Then
If longpress = True Then
Exit Sub
End If
quickaccess = False
luumuc = 0
If Image7.Visible = False Then
Image7.Visible = True
Else
Image7.Visible = False
End If
danhso = False
cancle = True
tbnhap.Text = "Completed"
Exit Sub
End If
If tbnhap.Text = "Ring Only" Or tbnhap.Text = "Vibrate Then Ring" Or tbnhap.Text = "Vibrate Only" Or tbnhap.Text = "No Ring or Vibrate" Then
If tbnhap.Text = "Vibrate Only" Or tbnhap.Text = "No Ring or Vibrate" Then
Image7.Visible = False
Else
Image7.Visible = True
End If
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
'vao menu con cua muc Set ringer tone
If tbnhap.Text = "Set Ringer Tone" Then
tbnhap.Text = "Standard Tone"
Exit Sub
End If
If tbnhap.Text = "Standard Tone" Or tbnhap.Text = "Music Tone" Then
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
'vao menu con cua muc Set ringer tone 2
If tbnhap.Text = "Set Ringer Tone 2" Then
tbnhap.Text = "Standard Tone"
Exit Sub
End If
'vao menu cua muc Phone Lock
If tbnhap.Text = "Phone Lock" Then
tbnhap.Text = "Automatic Lock"
Exit Sub
End If
If tbnhap.Text = "Automatic Lock" Then
tbnhap.Text = " On "
Exit Sub
End If
If Left(tbnhap.Text, 5) = " On " Then
autolocked = True
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = " Off " Then
tbnhap.Text = "Completed"
setup = False
autolocked = False
Exit Sub
End If
If tbnhap.Text = "Lock Now" Or (luumuc = 5 And quickaccess = True) Then
tbnhap.Text = "Locked"
locked = True
setup = False
quickaccess = False
luumuc = 0
Exit Sub
End If
If Left(tbnhap.Text, Len("Unlock Code")) = "Unlock Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = unlocked Then
locked = False
tbnhap.Text = "Menu"
setup = False
Else
tbnhap.Text = "Not Match"
danhso = False
End If
Exit Sub
End If
If tbnhap.Text = " Change Unlock Code" Then
tbnhap.Text = "Old Code" & vbCrLf
danhso = True
setup = False
Exit Sub
End If
If Left(tbnhap.Text, 8) = "Old Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = unlocked Then
tbnhap.Text = "New Code" & vbCrLf
Else
tbnhap.Text = " Not Match"
danhso = False
End If
Exit Sub
End If
If Left(tbnhap.Text, 8) = "New Code" Then
k = InStr(tbnhap.Text, vbLf)
If Len(Mid(tbnhap.Text, k + 1)) <> 4 Then
tbnhap.Text = "Enter 4 Digit"
danhso = False
Exit Sub
Else
unlocked = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
danhso = False
setup = False
Exit Sub
End If
End If
If tbnhap.Text = "Require SIM Card PIN" Then
tbnhap.Text = " On."
Exit Sub
End If
'xu ly cua muc Change SIM Pin2 code
If tbnhap.Text = "Change SIM PIN2 Code" Then
tbnhap.Text = "Current PIN2 Code" & vbCrLf
danhso = True
setup = False
Exit Sub
End If
If Left(tbnhap.Text, 17) = "Current PIN2 Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = pin2code Then
tbnhap.Text = "New PIN2 Code" & vbCrLf
Else
tbnhap.Text = " Invalid Code"
danhso = False
End If
Exit Sub
End If
If Left(tbnhap.Text, 13) = "New PIN2 Code" Then
k = InStr(tbnhap.Text, vbLf)
If Len(Mid(tbnhap.Text, k + 1)) < 4 Or Len(Mid(tbnhap.Text, k + 1)) > 8 Then
tbnhap.Text = "Enter 4-8 Digit"
danhso = False
Else
pin2code = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
setup = False
End If
Exit Sub
End If
'xu ly cua phan New Security Code
If tbnhap.Text = "New Security Code" Then
tbnhap.Text = "Current Code" & vbCrLf
danhso = True
setup = False
Exit Sub
End If
If Left(tbnhap.Text, 12) = "Current Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = securitycode Then
tbnhap.Text = "New Security Code" & vbCrLf
Else
tbnhap.Text = "Invalid Code"
danhso = False
End If
Exit Sub
End If
If Left(tbnhap.Text, 17) = "New Security Code" Then
k = InStr(tbnhap.Text, vbLf)
If Len(Mid(tbnhap.Text, k + 1)) <> 6 Then
tbnhap.Text = "Enter 6 Digit"
danhso = False
Else
securitycode = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
danhso = False
setup = False
End If
Exit Sub
End If
'xu ly cua phan Extended Menus
If tbnhap.Text = "Extended Menus" Then
tbnhap.Text = " On"
Exit Sub
End If
If tbnhap.Text = " On" Then
extend = True
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = " Off" Then
extend = False
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "Show Time and Date" Or (luumuc = 8 And quickaccess = True) Then
tbnhap.Text = Format(Now, "Medium Date") & vbCrLf & Format(Now, "Short Time")
If longpress = True Then
showtime = False 'True
Else
showtime = True
End If
setup = False
quickaccess = False
luumuc = 0
Exit Sub
End If
If tbnhap.Text = "Set Time and Date" Then
tbnhap.Text = "Enter Time" & vbCrLf
setup = False
cancle = False
Exit Sub
End If
If Left(tbnhap.Text, 10) = "Enter Time" Then
j = InStr(tbnhap.Text, vbLf)
If Not IsDate(Mid(tbnhap.Text, j + 1)) Then 'k < 1 Or k > 24 Then
tbnhap.Text = "Invalid Time"
cancle = True
danhso = False
Exit Sub
Else
newtime = Mid(tbnhap.Text, j + 1)
tbnhap.Text = "Enter Date" & vbCrLf
End If
Exit Sub
End If
If Left(tbnhap.Text, 10) = "Enter Date" Then
j = InStr(tbnhap.Text, vbLf)
If Not IsDate(Mid(tbnhap.Text, j + 1)) Then
tbnhap.Text = "Invalid Date"
cancle = True
danhso = False
Exit Sub
Else
newdate = Mid(tbnhap.Text, j + 1)
End If
Time = newtime
Date = newdate
tbnhap.Text = "Completed"
cancle = True
Exit Sub
End If
If tbnhap.Text = "Set Time Format" Then
tbnhap.Text = "12-hour?"
Exit Sub
End If
If tbnhap.Text = "12-hour?" Then
formattime = False
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "24-hour?" Then
formattime = True
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "Battery Saving Mode" Then
tbnhap.Text = "On"
setup = False
Exit Sub
End If
If tbnhap.Text = "On" Then
tbnhap.Text = "Completed"
features = False
network = False
accessory = False
message1 = False
Exit Sub
End If
If tbnhap.Text = "Off" Then
tbnhap.Text = "Completed"
features = False
network = False
accessory = False
message1 = False
Exit Sub
End If
If tbnhap.Text = "Select Keypad Tones" Then
tbnhap.Text = "Normal Tones"
Exit Sub
End If
If tbnhap.Text = "Normal Tones" Or tbnhap.Text = "Single Tone" Or tbnhap.Text = "No Tones" Then
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "Phone Status" Then
tbnhap.Text = "Status Review"
Exit Sub
End If
'phan xu ly cua menu Network Selection
If tbnhap.Text = "Network Selection" Then
tbnhap.Text = " Change Band"
network = True
Exit Sub
End If
If tbnhap.Text = " Change Band" Or (luumuc = 10 And quickaccess = True) Then 'longpress = False) Then
tbnhap.Text = "Change to 900/1800"
danhso = False
cancle = True
quickaccess = False
luumuc = 0
Exit Sub
End If
If tbnhap.Text = "Available Networks" Then
tbnhap.Text = "Wait.."
addnetwork = False
availablenetwork = True
Exit Sub
End If
If tbnhap.Text = "Choose From Available" Or tbnhap.Text = "Choose From Known" Then
addnetwork = True
availablenetwork = False
tbnhap.Text = "Wait.."
Exit Sub
End If
If tbnhap.Text = "Network Search" Then
tbnhap.Text = "Registration Preferences"
Exit Sub
End If
If tbnhap.Text = "Registration Preferences" Then
tbnhap.Text = "Automatic Search Mode"
Exit Sub
End If
If tbnhap.Text = "Automatic Search Mode" Or manualsearch = True Then
tbnhap.Text = "Registerring"
cancle = True 'False
danhso = False 'True
manualsearch = False
network = False
Exit Sub
End If
If tbnhap.Text = "Manual Search Mode" Then
Open filename5 For Random As #1 Len = Len(networks)
Get #1, 1, networks
tbnhap.Text = networks.mang
tam1 = 1
availablenetwork = True
manualsearch = True
Close #1
Exit Sub
End If
If tbnhap.Text = "Frequency of Search" Then
tbnhap.Text = "Slow Search"
Exit Sub
End If
'xu ly cua phan Preferred Networks
If tbnhap.Text = "Preferred Networks" Then
tbnhap.Text = "Add Network to List"
Exit Sub
End If
If tbnhap.Text = "Add Network to List" Then
tbnhap.Text = "Choose From Available"
Exit Sub
End If
If tbnhap.Text = "Show List of Networks" Then
Open filename6 For Random As #1 Len = Len(networks)
banghi = LOF(1) Len(networks)
If banghi = 0 Then
tbnhap.Text = "No Network in List"
Close #1
Exit Sub
End If
Get #1, 1, networks
tbnhap.Text = networks.mang
st = networks.mang
tam1 = 1
showlist = True
Close #1
Exit Sub
End If
If tbnhap.Text = "No Network in List" Then
tbnhap.Text = "Network Selection"
Exit Sub
End If
'xu ly cua muc Move to New Location
If showlist = True Then
tbnhap.Text = "Move to New Location"
showlist = False
Exit Sub
End If
If tbnhap.Text = "Move to New Location" Then
tbnhap.Text = "New Location?" & vbCrLf
danhso = True
cancle = True
network = False
Exit Sub
End If
If Left(tbnhap.Text, 4) = "New " Then
k = InStr(tbnhap.Text, vbLf)
lo = Val(Mid(tbnhap.Text, k + 1))
If lo = 0 Then
tbnhap.Text = "New Location?" & vbCrLf
Exit Sub
End If
Call movenew(tam1, lo)
network = False
showlist = False
End If
'xu ly cua muc Delete Network
If tbnhap.Text = "Delete Network" Then
tbnhap.Text = "Are you sure?"
Exit Sub
End If
If tbnhap.Text = "Are you sure?" Then
Call xoa(tam1)
network = False
showlist = False
Exit Sub
End If
'xu ly cua phan Find New Network
If tbnhap.Text = "Find New Network" Then
tbnhap.Text = "Finding"
network = False
Exit Sub
End If
'phan xu ly cua muc Change Band
If tbnhap.Text = "Change to 900/1800" Or tbnhap.Text = "Change to 900" Or tbnhap.Text = "Change to 1800" Then
tbnhap.Text = "Completed"
quickaccess = False
danhso = False
cancle = True
network = False
Exit Sub
End If
If addnetwork = True Then
availablenetwork = False
tbnhap.Text = " Location?" & vbCrLf
danhso = True
cancle = True
addnetwork = False
network = False
Exit Sub
End If
'xu ly cua muc available network
If availablenetwork = True Then
tbnhap.Text = "Register Now"
availablenetwork = False
Exit Sub
End If
If tbnhap.Text = "Register Now" Then
tbnhap.Text = "Register"
network = False
Exit Sub
End If
If tbnhap.Text = "Make Preferred" Then
tbnhap.Text = " Location?" & vbCrLf
danhso = True
cancle = True
network = False
Exit Sub
End If
If Left(tbnhap.Text, 10) = " Location?" Then
k = InStr(tbnhap.Text, vbLf)
lo = Val(Mid(tbnhap.Text, k + 1))
If lo = 0 Then
tbnhap.Text = " Location?" & vbCrLf
Exit Sub
End If
Call preferredlist(lo, st)
tbnhap.Text = "Completed"
network = False
danhso = False
Exit Sub
End If
'phan xu ly cua muc Frequency of search
If tbnhap.Text = "Slow Search" Or tbnhap.Text = "Medium Search" Or tbnhap.Text = "Fast Search" Or tbnhap.Text = "Continuous Search" Then
tbnhap.Text = "Completed"
network = False
danhso = False
Exit Sub
End If
'phan xu ly cua menu Accessory Setup
If tbnhap.Text = "Accessory Setup" Then
tbnhap.Text = "Mute Car Radio"
accessory = True
Exit Sub
End If
'vao menu con cua cac muc trong Accessory setup
If tbnhap.Text = "Mute Car Radio" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Automatic Answer" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Automatic Handsfree" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Safety Timer" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Auxiliary Alert" Then
tbnhap.Text = "On"
Exit Sub
End If
'phan xu ly cua muc Quick Access Menu
If longpress = True Then 'And st <> "" Then
Open filename3 For Random As #1 Len = Len(menuaccess)
Get #1, orderinquick, menuaccess
menuaccess.feature = st
menuaccess.thutu = luumuc
Put #1, orderinquick, menuaccess
Close #1
longpress = False
tbnhap.Text = "Completed"
thu = False
quickaccess = False
Exit Sub
End If
'truong hop user nhap vao mot so de lam mot cuoc goi
If IsNumeric(tbnhap.Text) = True And sending = False Then
st = tbnhap.Text
If Len(tbnhap.Text) < 7 Then
If tbnhap.Text = "1080" Or tbnhap.Text = "113" Or tbnhap.Text = "114" Or tbnhap.Text = "115" Then
cancall = False
Else
cancall = True
End If
If send = True Then
sending = True
send = False
End If
End If
danhso = False
cancle = True
tbnhap.Text = "Calling" '" Call Number"
Image2.Visible = True
callnumber = True
End If
'truong hop user nhap vao so dien thoai co format khong phu hop
If tbnhap.Text = "Connecting Failed" Then
tbnhap.Text = "Menu"
Exit Sub
End If
'********* phim left *********
Case 14
'menu con cua muc Personal Number
If quickaccess = True Then
Exit Sub
End If
'xu ly cua muc Adjust Ring Volume
If advolume = True Then
i = i + 1
If vol > 0 Then
Select Case i
Case 3, 6, 9, 12, 15, 18, 21
vol = vol - 1
volume.Picture = volume1(vol).Picture
End Select
Else
Beep
End If
Exit Sub
End If
'********** phim phai **********
Case 15
If quickaccess = True Then 'longpress = True Then
Exit Sub
End If
If cancle = False Then
Select Case i
Case 0
tbnhap.Text = tbnhap.Text & Right(tbnhap.Text, 1)
i = i + 1
Case 1
tbnhap.Text = tbnhap.Text & " "
End Select
Else
'xu ly cua phan Adjust Ring Volume
If advolume = True Then
i = i + 1
If vol < 7 Then
Select Case i
Case 3, 6, 9, 12, 15, 18, 21
vol = vol + 1
volume.Picture = volume1(vol).Picture
End Select
Else
Beep
End If
Exit Sub
End If
End If
'****** day la phan xu ly cua phim OnOff *******
Case 16
phonebook = False
quickaccess = False
message1 = False
setup = False
network = False
listdial = False
editentrylist = False
addentrylist = False
eraseentrylist = False
changecase = False
messagelist = False
taomoi = False
editor = False
availablenetwork = False
addnetwork = False
Image2.Visible = False
Select Case onoff
Case 0
screen.Visible = True
Frame1.Visible = False
tbnhap.Visible = False
If volume.Visible = True Then
volume.Visible = False
Frame1.Height = 500
Frame1.Width = 1800
End If
onoff = 1
Exit Sub
Case 1
screen.Visible = False
Frame1.Visible = True
tbnhap.Visible = True
If autolocked = True Or locked = True Then
tbnhap.Text = "Locked"
Else
tbnhap.Text = "Menu"
End If
onoff = 0
Exit Sub
End Select
'phan xu ly cua menu quick access
Case 17
If locked = True Then
Exit Sub
End If
If volume.Visible = True Then 'And so(14).Value = False And so(15).Value = False Then
volume.Visible = False
tbnhap.Visible = True
Frame1.Height = 500
Frame1.Width = 1800
End If
Image2.Visible = False
network = False
phonebook = False
setup = False
listdial = False
editentrylist = False
addentrylist = False
eraseentrylist = False
changecase = False
messagelist = False
taomoi = False
editor = False
availablenetwork = False
addnetwork = False
Open filename3 For Random As #1 Len = Len(menuaccess)
Get #1, 1, menuaccess
tbnhap.Text = Trim(menuaccess.feature)
orderinquick = 1
luumuc = menuaccess.thutu
quickaccess = True
phonebook = False
thu = True
danhso = False
cancle = False
Close #1
Exit Sub
End Select
End Sub
'****** CHUONG TRINH CON THEM SO DT MOI *****
Private Sub add_entry(st As String, nu As String, lo As Integer, flag As Boolean)
Dim news As entry
Dim banghi As Byte
Dim j As Byte
If addentrylist = True Then
Open filefixed For Random As #1 Len = Len(news)
Else
Open filename For Random As #1 Len = Len(news)
End If
banghi = LOF(1) Len(news)
For j = 1 To banghi
Get #1, j, news
If news.location = lo Then
tbnhap.Text = "Overwritten?"
Close #1
Exit Sub
End If
Next j
news.name = st
news.number = nu
news.location = lo
banghi = banghi + 1
If addentrylist = True Then
Put #1, banghi, news
Else
If flag = True Then
Put #1, banghi, news
Else
Put #1, banghi, news
End If
End If
addentrylist = False
listdial = False
tbnhap.Text = "Stored" & Str(lo)
Close #1
End Sub
'**** THU TUC TIM VI TRI SE GHI MOT MUC KHI USER KHONG NHAP VAO LOCATION ****
Private Function add_lo(co As Boolean) As Integer
Dim news As entry
Dim banghi As Byte
Dim j As Integer
Dim i As Integer
Dim timthay As Boolean
If co = True Then
i = 1
If addentrylist = True Then
Open filefixed For Random As #1 Len = Len(news)
Else
Open filename For Random As #1 Len = Len(news)
End If
banghi = LOF(1) Len(news)
If banghi = 0 Then
add_lo = 1
timthay = False
Close #1
Else
timthay = True
End If
Do While timthay = True
For j = 1 To banghi
Get #1, j, news
If i = news.location Then
i = i + 1
timthay = True
Exit For
Else
If j = banghi Then
add_lo = i
timthay = False
Close #1
Exit Do
End If
End If
Next j
Loop
Else
i = 101
Open filename For Random As #1 Len = Len(news)
banghi = LOF(1) Len(news)
If banghi = 0 Then
add_lo = 101
timthay = False
Else
timthay = True
End If
Do While timthay = True
For j = 1 To banghi
Get #1, j, news
If i = news.location Then
i = i + 1
timthay = True
Exit For
Else
If j = banghi Then
add_lo = i
timthay = False
Close #1
Exit Do
End If
End If
Next j
Loop
Close #1
End If
End Function
'***** CHUONG TRINH CON TIM SO DT THEO TEN ******
Private Sub find_name(ten As String)
Dim news As entry
Dim i As Integer
Dim j As Integer
Dim banghi As Integer
Select Case prevent
Case 1
Open filename For Random As #1 Len = Len(news)
banghi = LOF(1) Len(news)
Case 2, 3
Open filename2 For Random As #1 Len = Len(news)
banghi = LOF(1) Len(news)
Case 4
found = False
tbnhap.Text = "No Name Stored"
Exit Sub
End Select
'**** Truong hop khong co ten nao da duoc luu ****
If banghi = 0 Then
found = False
tbnhap.Text = "No Name Stored"
Close #1
Exit Sub
End If
'**** truong hop user khong nhap ten de tim ********
If ten = "" And banghi <> 0 Then
Get #1, 1, news
found = True
vitri = 1
st1 = news.name
st = news.name
nu = news.number
tbnhap.Text = st & vbCrLf & nu
Close #1
flag = True
Exit Sub
'truong hop ten nhap vao trung voi ten da luu
Else
For i = 1 To banghi
Get #1, i, news
If StrComp(Left(news.name, Len(ten)), ten) = 0 Then
found = True
vitri = i
st = news.name
nu = news.number
st1 = news.name
tbnhap.Text = st & vbCrLf & nu
flag = True
Close #1
Exit Sub
End If
Next i
End If
'truong hop ten nhap vao khong trung voi ten da luu
For i = 1 To banghi
Get #1, i, news
If StrComp(Left(news.name, 1), Left(ten, 1)) = 0 Then
found = True
vitri = i
st = news.name
nu = news.number
st1 = news.name
tbnhap.Text = st & vbCrLf & nu
flag = True
Close #1
Exit Sub
End If
Next i
'truong hop ten nhap vao khong tin thay, lay entry dau tien
Get #1, 1, news
st1 = news.name
st = news.name
nu =