24/05/2018, 22:11

Mã nguồn của ActiveX Control

Khai báo các biến chung Option Explicit Private Type entry 'khai bao entry la muc kieu ban ghi name As String * 10 number As String * 10 location As Integer End Type ...

Khai báo các biến chung

Option Explicit

Private Type entry 'khai bao entry la muc kieu ban ghi

name As String * 10

number As String * 10

location As Integer

End Type

Private Type access 'khai bao access la mot kieu ban ghi

feature As String * 16 'luu giu ten tinh nang trong menu quick access

thutu As Integer

End Type

Private Type messages

tin As String * 25

sothutu As Integer

End Type

Private Type netselect

mang As String * 10

End Type

Dim found As Boolean 'la true khi tim thay entry can tim

Const filename3 = "c:menuquickaccess.lst"

Const filename = "c:entryphone.lst"

Const filename1 = "c:entrysim.lst"

Const filename2 = "c:entryprevent.lst"

Const filename4 = "c:messages.lst"

Const filetam = "c:filetam.lst"

Const filename5 = "c:filenetwork.list"

Const filename6 = "c:preferrednetwork.list"

Const filefixed = "c:fixeddialling.lst"

Dim i As Integer

Dim st1 As String

Dim lo As Integer 'bien luu location

Dim nu As String 'bien luu number

Dim st As String 'bien luu name

Dim vitri As Integer 'giu vi tri khi tim thay hoac di chuyen giua cac entry

Dim flag As Boolean

Dim prevent As Integer 'giu trang thai trong muc Prevent Access

Dim formattime As Boolean

Dim unlocked As String 'luu chuoi giai ma khi phone o trang thai lock

Dim line2 As Boolean 'co bang true khi line2 o trang thai ON

Dim securitycode As String

Dim pin2code As String 'luu chuoi ma PIN2

Dim advolume As Boolean 'bien co khi vao muc Adjust Ring Volume

Dim vol As Integer 'luu gia tri hien tai cua volume o muc thu bao nhieu

Dim menucon As Boolean 'bien giu vao menu con cua Find

Dim aftermouseup As Date

Dim aftermousedown As Date

Dim danhso As Boolean 'ghi trang thai ban phim la so

Dim cancle As Boolean

Dim longpress As Boolean 'khi nguoi su dung nhan va giu phim

Dim quickaccess As Boolean 'khi vao trong menu quickaccess

Dim orderinquick As Integer

Dim thu As Boolean 'bien co khi nhan va giu mot phim de vao menu quick access

Dim changecase As Boolean 'doi chu hoa thanh thuong va nguoc lai

Dim onetouchphone As Boolean 'goi so bang 1 phim trong bo nho may

Dim onetouchof As Byte 'nhan biet One Touch Dial cua muc nao

Dim messagelist As Boolean 'bien co khi vao trong danh sach message

Dim taomoi As Boolean 'bien co cho biet la tao tin nhan moi hay la thay doi tin nhan

Dim voicemailnumber As String 'luu so voicemail

Dim servicecentre As String 'luu so service centre

Dim expiryperiod As String 'bien luu gia tri max hour cua 1 tin nhan khi chua gui di trong message setting

Dim messagenumber As Integer 'so thu tu cua message

Dim editor As Boolean 'bien co khi hieu chinh tin nhan

Dim availablenetwork As Boolean 'bien khi lam viec trong muc available networks

Dim tam1 As Integer

Dim cancall As Boolean 'de biet mot so co the goi duoc hay khong

Dim setupfixed As Boolean 'trong muc setup fixed dialling

Dim listdial As Boolean 'bien co dung de di chuyen giua nhung muc trong danh sach Fixed Dial

Dim editentrylist As Boolean 'bien dung trong muc edit entry cua Fixed dial

Dim eraseentrylist As Boolean 'bien dung trong muc edit entry cua Fixed dial

Dim addentrylist As Boolean 'bien dung trong Add Entry cua Fixed Dialling

Dim callbarring As Boolean 'bien dung trong muc Call Barring

Dim barpassword As String 'luu ma chan cuoc goi

Dim showtime As Boolean

Dim luumuc As Integer 'luu muc trong menu quick access

Thủ tục khi nhấn phím chuột

Private Sub so_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

aftermousedown = Time

End Sub

Thủ tục khi thả chuột

Private Sub so_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim k As Integer

Dim st As String

Dim st1 As String

Static switch As Boolean

Dim starttime As Date

Dim menuaccess As access

Dim news As entry

Dim banghi As Byte

Dim j As Byte

Dim co As Boolean

aftermouseup = Time

starttime = aftermouseup - aftermousedown

If Second(starttime) > 2 Then

'xu ly khi user nhan va giu phim OK de vao bang chuc nang trong Quick Access

If Index = 13 And thu = True Then

If volume.Visible = True Then volume.Visible = False

tbnhap.Visible = True

Frame1.Height = 500

Frame1.Width = 1800

End If

showtime = False

tbnhap.Text = "Find by Name"

Image2.Visible = False

st = tbnhap.Text

longpress = True

cancle = True

danhso = False

Exit Sub

End If

'xu ly cua muc chuyen chu hoa thanh chu thuong trong khi nhap chu

If changecase = True Then

If switch = False Then

k = InStr(tbnhap.Text, vbLf)

st = LCase(Mid(tbnhap.Text, k + 1))

st1 = tbnhap.Text

Mid(st1, k + 1) = st

tbnhap.Text = Left(st1, Len(st1) - 1)

switch = True

Exit Sub

Else

k = InStr(tbnhap.Text, vbLf)

st = UCase(Mid(tbnhap.Text, k + 1))

st1 = tbnhap.Text

Mid(st1, k + 1) = st

tbnhap.Text = Left(st1, Len(st1) - 1)

switch = False

Exit Sub

End If

End If

'xu ly khi nhan va giu phim cancle de xoa va bat dau tin nhan moi

If Index = 10 And editor = True Then 'messagelist = True Then tbnhap.Text = ""

danhso = False

cancle = False

taomoi = True

messagelist = False

Exit Sub

End If

'xu ly cua phan One-touch Dial Setting

If onetouchphone = True Then

danhso = False

Select Case Index

Case 1

Call onetouch(1)

Case 2

Call onetouch(2)

Case 3

Call onetouch(3)

Case 4

Call onetouch(4)

Case 5

Call onetouch(5)

Case 6

Call onetouch(6)

Case 7

Call onetouch(7)

Case 8

Call onetouch(8)

Case 9

Call onetouch(9)

End Select

Else

danhso = True

Exit Sub

End If

Else

Exit Sub

End If

End Sub

Thủ tục khi nhấn một phím số

Private Sub so_Click(Index As Integer)

Dim n As Byte 'bien luu len(tbnhap)cho su kien index

Dim j As Byte 'giu gia tri cho vong lap

Static swit As Boolean 'xet luu o dt hay SIM

Dim k As Integer

Dim ch As String

Dim news As entry

Static tam As Integer 'luu gia tri tam khi o trong tinh nang Prevent Access

Dim menuaccess As access

Dim message As messages

Static onoff As Boolean

Dim banghi As Byte

Static setup As Boolean 'bien co khi lam viec voi muc Phone setup

Static extend As Boolean 'bien co devao nhung muc cua menu mo rong

Static newdate As Date

Static newtime As Date

Static locked As Boolean 'bien co khi lam viec voi muc Phone lock

Static autolocked As Boolean

Static phonebook As Boolean 'bien co khi lam viec voi muc Phone Book

Static accessory As Boolean 'bien co trong menu Accessory

Static network As Boolean 'bien co trong menu Network

Static features As Boolean 'bien co trong menu CAll related features

Static message1 As Boolean

Static callnumberfixed As Boolean

Static sending As Boolean 'bien co de biet co gui tin nhan di khong

Static voice As Boolean 'co khi vao trong muc voice mail number

Static service As Boolean 'co khi vao trong muc service centre

Static expiry As Boolean 'co khi vao trong muc expiry period

Static setting As Boolean 'co khi vao trong message setting va nhan cancle

Static send As Boolean 'de nhan biet trong muc send message

Static callnumber As Boolean

Dim networks As netselect

Static showlist As Boolean 'danh sach preferred network

Static manualsearch As Boolean 'bien co trong muc Manual Search Mode

Static addnetwork As Boolean 'bien co trong muc Add Network to List

Dim cd As Integer

Static timthay As Boolean 'tim duoc muc trong Fixed dial

Dim chuoitam As String

If tbnhap.Text = "Locked" Then

tbnhap.Text = "Unlock Code" & vbCrLf

danhso = True

cancle = True

Exit Sub

End If

If showtime = True Then

tbnhap.Text = "Menu"

showtime = False

Exit Sub

End If

If tbnhap.Text = "Menu" Then

If Index >= 0 And Index < 10 Then

tbnhap.Text = ""

danhso = True

cancle = True

End If

End If

'khi nguoi su dung nhan so de lam cuoc goi

If (danhso = True) Or Left(tbnhap.Text, 11) = "Unlock Code" Then

Select Case Index

Case 0

tbnhap.Text = tbnhap.Text & "0"

Case 1

tbnhap.Text = tbnhap.Text & "1"

Case 2

tbnhap.Text = tbnhap.Text & "2"

Case 3

tbnhap.Text = tbnhap.Text & "3"

Case 4

tbnhap.Text = tbnhap.Text & "4"

Case 5

tbnhap.Text = tbnhap.Text & "5"

Case 6

tbnhap.Text = tbnhap.Text & "6"

Case 7

tbnhap.Text = tbnhap.Text & "7"

Case 8

tbnhap.Text = tbnhap.Text & "8"

Case 9

tbnhap.Text = tbnhap.Text & "9"

End Select

End If

'truong hop cho phep user dung ban phim de nhap ky tu

If cancle = False Then

Select Case Index

'********** phim so 0 *****************

Case 0

'user dung phim so trong menu message

If quickaccess = True Then

Exit Sub

End If

If messagelist = True Then

tbnhap.Text = "Invalid Msg Number"

messagelist = False

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "+"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "-"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "0"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "="

i = i + 1

Case 4

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "*"

i = i + 1

Case 5

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "/"

'i = 0

End Select

'**************phim so 1*****************

Case 1

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(1)

orderinquick = 1

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(1)

Exit Sub

End If

'user dung phim de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & " "

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "."

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "1"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "?"

i = i + 1

Case 4

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "!"

i = i + 1

Case 5

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & ":"

'i = 0

End Select

'**************phim so 2******************

Case 2

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(2)

orderinquick = 2

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(2)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "A"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "B"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "C"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "2"

'i = 0

End Select

'****************phim so 3***************

Case 3

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(3)

orderinquick = 3

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(3)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "D"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "E"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "F"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "3"

'i = 0

End Select

'***************phim so 4****************

Case 4

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(4)

orderinquick = 4

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(4)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "G"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "H"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "I"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "4"

'i = 0

End Select

'************** phim so 5 ***************

Case 5

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(5) 'menuaccess.thutu

orderinquick = 5

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(5)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "J"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "K"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "L"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "5"

'i = 0

End Select

'*************** phim so 6 ***************

Case 6

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(6) 'menuaccess.thutu

orderinquick = 6

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(6)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "M"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "N"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "O"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "6"

'i = 0

End Select

'**************** phim so 7 **************

Case 7

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(7)

orderinquick = 7

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(7)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "P"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "Q"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "R"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "S"

i = i + 1

Case 4

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "7"

'i = 0

End Select

'*********** phim so 8 *******************

Case 8

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(8)

orderinquick = 8

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(8)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "T"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "U"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "V"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "8"

'i = 0

End Select

'************* phim so 9 *****************

Case 9

'user dung phim so trong menu quick access

If quickaccess = True Then

luumuc = clickquickaccess(9)

orderinquick = 9

Exit Sub

End If

'user dung phim so trong menu message

If messagelist = True Then

Call clickmessage(9)

Exit Sub

End If

'user dung phim so de nhap ky tu

Select Case i

Case 0

tbnhap.Text = tbnhap.Text & "W"

i = i + 1

Case 1

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "X"

i = i + 1

Case 2

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "Y"

i = i + 1

Case 3

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "Z"

i = i + 1

Case 4

n = Len(tbnhap.Text)

tbnhap.Text = Left(tbnhap.Text, n - 1) & "9"

'i = 0

End Select

End Select

End If

'********** phim cancle ******************

Select Case Index

Case 10

If volume.Visible = True Then

Exit Sub

End If

If locked = True Or autolocked = True Then

Exit Sub

End If

If callnumberfixed = True Then

callnumberfixed = False

End If

If listdial = True Then

listdial = False

'Exit Sub

End If

If callnumber = True Then

tbnhap.Text = "Menu"

callnumber = False

'Exit Sub

End If

If found = True Then 'And setup = False Then

tbnhap.Text = "Phone Book"

found = False

flag = False

menucon = False

Exit Sub

End If

If phonebook = True Then

tbnhap.Text = "Phone Book"

phonebook = False

send = False

Exit Sub

End If

'se thoat ra muc Phone Setup khi dang lam viec voi menu con cua no

If setup = True Then

tbnhap.Text = "Phone Setup"

setup = False

Exit Sub

End If

'neu dang nam trong menu quick access then

If quickaccess = True Then

tbnhap.Text = "Menu"

quickaccess = False

danhso = True

Exit Sub

End If

If longpress = True Then

tbnhap.Text = "Menu"

longpress = False

danhso = True

Exit Sub

End If

If tbnhap.Text = "Overwritten?" Then

tbnhap.Text = "Enter Location!" & vbCrLf

Exit Sub

End If

If accessory = True Then

tbnhap.Text = "Accessory Setup"

accessory = False

Exit Sub

End If

If network = True Then

tbnhap.Text = "Network Selection"

network = False

showlist = False

Exit Sub

End If

If features = True Then

tbnhap.Text = "Call Related Features"

features = False

Exit Sub

End If

If message1 = True Then

tbnhap.Text = "Messages"

message1 = False

messagelist = False

Exit Sub

End If

If tbnhap.Text = "Phone Book" Or tbnhap.Text = "Messages" Or tbnhap.Text = "Phone Setup" Then

tbnhap.Text = "Menu"

Exit Sub

End If

If tbnhap.Text = "Call Related Features" Or tbnhap.Text = "Network Selection" Or tbnhap.Text = "Accessory Setup" Then

tbnhap.Text = "Menu"

Exit Sub

End If

If tbnhap.Text = "Are you sure?" Then

tbnhap.Text = "Network Selection"

network = False

showlist = False

Exit Sub

End If

If availablenetwork = True Or addnetwork = True Then

tbnhap.Text = "Network Selection"

availablenetwork = False

addnetwork = False

Exit Sub

End If

If editentrylist = True Or eraseentrylist = True Or addentrylist = True Then

editentrylist = False

addentrylist = False

eraseentrylist = False

Exit Sub

End If

If danhso = False And cancle = True Then

tbnhap.Text = "Menu"

danhso = True

Exit Sub

End If

If danhso = True Or cancle = False Then

If editor = True Then

n = Len(tbnhap.Text)

If n = 0 Then

tbnhap.Text = "Messages"

editor = False

danhso = False

cancle = True

Exit Sub

Else

tbnhap.Text = Left(tbnhap.Text, n - 1)

Exit Sub

End If

End If

If setting = True Then

n = Len(tbnhap.Text)

If n = 0 Then

tbnhap.Text = "Messages"

danhso = False

cancle = True

setting = False

Else

tbnhap.Text = Left(tbnhap.Text, n - 1)

End If

Exit Sub

End If

k = InStr(tbnhap.Text, vbCr)

n = Len(tbnhap.Text)

If n = 0 Then

tbnhap.Text = "Menu"

Exit Sub

End If

If n = k + 1 Then

'Beep

tbnhap.Text = "Phone Book" '"Personal Number"

cancle = True

danhso = False

changecase = False

'Exit Sub

Else

If tbnhap.Text = "Menu" Then

Beep

Else

tbnhap.Text = Left(tbnhap.Text, n - 1)

Exit Sub

End If

End If

End If

'************ Phim menu-up ***************

Case 11

If tbnhap.Text = "Network Selection" Then

tbnhap.Text = "Phone Setup"

Exit Sub

End If

If tbnhap.Text = "Phone Setup" Then

tbnhap.Text = "Messages"

Exit Sub

End If

If tbnhap.Text = "Messages" Then

tbnhap.Text = "Call Related Features"

Exit Sub

End If

If tbnhap.Text = "Call Related Features" Then

tbnhap.Text = "Phone Book"

Exit Sub

End If

If tbnhap.Text = "Phone Book" Then

tbnhap.Text = "Accessory Setup"

Exit Sub

End If

If tbnhap.Text = "Accessory Setup" Then

tbnhap.Text = "Network Selection"

Exit Sub

End If

'menu con cua muc Phone Book

If tbnhap.Text = "One-Touch Dial Setting" Then

tbnhap.Text = "Fixed Dialling"

Exit Sub

End If

If Trim(tbnhap.Text) = "Fixed Dialling" Then

tbnhap.Text = "Personal Number"

Exit Sub

End If

If tbnhap.Text = "Personal Number" Then

tbnhap.Text = "One-Touch Dial Setting"

Exit Sub

End If

'vao menu con cua muc Personal Number

If tbnhap.Text = "Prevent Access" Then

tbnhap.Text = "Check Capacity"

Exit Sub

End If

If tbnhap.Text = "Check Capacity" Then

tbnhap.Text = "Add Entry"

Exit Sub

End If

If tbnhap.Text = "Add Entry" Then

tbnhap.Text = "Find Entry by Location"

Exit Sub

End If

If tbnhap.Text = "Find Entry by Location" Then

tbnhap.Text = "Find Entry by Name"

Exit Sub

End If

If tbnhap.Text = "Find Entry by Name" Then

tbnhap.Text = "Prevent Access"

Exit Sub

End If

'vao menu con cua muc Check Capacity

If tbnhap.Text = "Check SIM Capacity" Then

tbnhap.Text = "Check Phone Capacity"

Exit Sub

End If

If tbnhap.Text = "Check Phone Capacity" Then

tbnhap.Text = "Check SIM Capacity"

Exit Sub

End If

'vao menu con cua muc Find Entry

If tbnhap.Text = "Erase Name and Number" Then

tbnhap.Text = "Modify Name or Number"

Exit Sub

End If

If tbnhap.Text = "Modify Name or Number" Then

tbnhap.Text = "Call Number"

Exit Sub

End If

If tbnhap.Text = "Call Number" Then

tbnhap.Text = "Erase Name and Number"

Exit Sub

End If

'menu con cua muc Prevent Access

If tbnhap.Text = "To Phone & SIM Memory" Then

tbnhap.Text = "To Phone Memory"

Exit Sub

End If

If tbnhap.Text = "To Phone Memory" Then

tbnhap.Text = "To SIM Card Memory"

Exit Sub

End If

If tbnhap.Text = "To SIM Card Memory" Then

tbnhap.Text = "No Memory Restrictions"

Exit Sub

End If

If tbnhap.Text = "No Memory Restrictions" Then

tbnhap.Text = "To Phone & SIM Memory"

Exit Sub

End If

'menu con cua muc Add Entry

If tbnhap.Text = "Add To SIM Card Memory" Then

tbnhap.Text = "Add To Phone Memory"

Exit Sub

End If

If tbnhap.Text = "Add To Phone Memory" Then

tbnhap.Text = "Add To SIM Card Memory"

Exit Sub

End If

'xu ly cua muc Fixed Dialling

If tbnhap.Text = "Setup Fixed Dialling" Then

tbnhap.Text = "View Fixed Dial List"

Exit Sub

End If

If tbnhap.Text = "View Fixed Dial List" Then

tbnhap.Text = "Setup Fixed Dialling"

Exit Sub

End If

'xu ly cua muc Setup Fixed Dialling

If tbnhap.Text = "Off." Then

tbnhap.Text = "On."

Exit Sub

End If

If tbnhap.Text = "Erase Entry" Then

tbnhap.Text = " Add Entry"

Exit Sub

End If

If tbnhap.Text = " Add Entry" Then

tbnhap.Text = "Edit Entry"

Exit Sub

End If

If tbnhap.Text = "Edit Entry" Then

tbnhap.Text = "Off."

Exit Sub

End If

If tbnhap.Text = "On." Then

tbnhap.Text = "Erase Entry"

Exit Sub

End If

'phan xu ly khi vao menu con cua muc One-Touch Dial Setting

If tbnhap.Text = " To SIM Memory" Then

tbnhap.Text = " To Phone Memory"

Exit Sub

End If

If tbnhap.Text = " To Phone Memory" Then

tbnhap.Text = " To Fixed Dial List"

Exit Sub

End If

If tbnhap.Text = " To Fixed Dial List" Then

tbnhap.Text = " To SIM Memory"

Exit Sub

End If

'phan xu ly cua menu Call Related Features

If tbnhap.Text = "Key Answer Only" Then

tbnhap.Text = "Call Barring"

Exit Sub

End If

If tbnhap.Text = "Call Barring" Then

tbnhap.Text = "Call Waiting"

Exit Sub

End If

If tbnhap.Text = "Call Waiting" Then

tbnhap.Text = "Talk and Fax"

Exit Sub

End If

If tbnhap.Text = "Talk and Fax" Then

tbnhap.Text = "Call Diverting"

Exit Sub

End If

If tbnhap.Text = "Call Diverting" Then

tbnhap.Text = "Restrict My Phone Number"

Exit Sub

End If

If tbnhap.Text = "Restrict My Phone Number" Then

tbnhap.Text = "Show Battery Meter"

Exit Sub

End If

If tbnhap.Text = "Show Battery Meter" Then

tbnhap.Text = "Key Answer Only"

Exit Sub

End If

'vao menu con cua muc Restrict My Phone Number

If tbnhap.Text = "Show ID On Next Call" Then

tbnhap.Text = "Restrict ID On Next Call"

Exit Sub

End If

If tbnhap.Text = "Restrict ID On Next Call" Then

tbnhap.Text = "Show ID On Next Call"

Exit Sub

End If

'vao menu con cua muc Call Diverting

If tbnhap.Text = "Divert Voice Calls" Then

tbnhap.Text = "Cancel All Diverting"

Exit Sub

End If

If tbnhap.Text = "Cancel All Diverting" Then

tbnhap.Text = "Divert Data Calls"

Exit Sub

End If

If tbnhap.Text = "Divert Data Calls" Then

tbnhap.Text = "Divert Fax Calls"

Exit Sub

End If

If tbnhap.Text = "Divert Fax Calls" Then

tbnhap.Text = "Divert Voice Calls"

Exit Sub

End If

'vao menu con cua muc Divert Voice Calls

If tbnhap.Text = "Divert When Unavailable" Then

tbnhap.Text = "Detailed Diverting"

Exit Sub

End If

If tbnhap.Text = "Detailed Diverting" Then

tbnhap.Text = "Divert All Voice Calls"

Exit Sub

End If

If tbnhap.Text = "Divert All Voice Calls" Then

tbnhap.Text = "Divert When Unavailable"

Exit Sub

End If

'vao menu con cua muc Detailed Diverting

If tbnhap.Text = "If No Answer" Then

tbnhap.Text = "If Not Reachable"

Exit Sub

End If

If tbnhap.Text = "If Not Reachable" Then

tbnhap.Text = "If Busy"

Exit Sub

End If

If tbnhap.Text = "If Busy" Then

tbnhap.Text = "If No Answer"

Exit Sub

End If

'vao menu con cua muc Call Barring

If tbnhap.Text = "Change Bar Password" Then

tbnhap.Text = "Cancel All Barring"

Exit Sub

End If

If tbnhap.Text = "Cancel All Barring" Then

tbnhap.Text = "Bar Incoming Calls"

Exit Sub

End If

If tbnhap.Text = "Bar Incoming Calls" Then

tbnhap.Text = "Bar Outgoing Calls"

Exit Sub

End If

If tbnhap.Text = "Bar Outgoing Calls" Then

tbnhap.Text = "Change Bar Password"

Exit Sub

End If

'vao menu con cua muc Bar Outgoing Calls

If tbnhap.Text = "Off?" Then

tbnhap.Text = "All Calls"

Exit Sub

End If

If tbnhap.Text = "All Calls" Then

tbnhap.Text = "Int'l Calls Expect Home"

Exit Sub

End If

If tbnhap.Text = "Int'l Calls Expect Home" Then

tbnhap.Text = "Int'l Calls"

Exit Sub

End If

If tbnhap.Text = "Int'l Calls" Then

tbnhap.Text = "Off?"

Exit Sub

End If

'vao menu con cua muc Bar Incoming Call

If tbnhap.Text = "Off? " Then

tbnhap.Text = " All Calls"

Exit Sub

End If

If tbnhap.Text = " All Calls" Then

tbnhap.Text = "When Roaming"

Exit Sub

End If

If tbnhap.Text = "When Roaming" Then

tbnhap.Text = "Off? "

Exit Sub

End If

'phan xu ly cua menu Message

If tbnhap.Text = "Outgoing Messages" Then

tbnhap.Text = "Call Voicemail"

Exit Sub

End If

If tbnhap.Text = "Message Editor" Then

tbnhap.Text = "Outgoing Messages"

Exit Sub

End If

If tbnhap.Text = "Cell Broadcast" Then

tbnhap.Text = "Message Editor"

Exit Sub

End If

If tbnhap.Text = "Message Settings" Then

tbnhap.Text = "Cell Broadcast"

Exit Sub

End If

If tbnhap.Text = "Call Voicemail" Then

tbnhap.Text = "Message Settings"

Exit Sub

End If

'vao menu con cua muc Outgoing Message

If tbnhap.Text = "Edit Message" Then

tbnhap.Text = "Send Message"

Exit Sub

End If

If tbnhap.Text = "Delete Message" Then

tbnhap.Text = "Edit Message"

Exit Sub

End If

If tbnhap.Text = "Go to Next Message" Then

tbnhap.Text = "Delete Message"

Exit Sub

End If

If tbnhap.Text = "Send Message" Then

tbnhap.Text = "Go to Next Message"

Exit Sub

End If

'vao menu con cua muc Edit Message

If tbnhap.Text = " Send Message" Then

tbnhap.Text = "Store Message"

Exit Sub

End If

If tbnhap.Text = "Store Message" Then

tbnhap.Text = " Send Message"

Exit Sub

End If

'vao menu con cua muc Send Message

If tbnhap.Text = " Find Entry by Location" Then

tbnhap.Text = " Find Entry by Name"

Exit Sub

End If

If tbnhap.Text = " Find Entry by Name" Then

tbnhap.Text = " Enter Number"

Exit Sub

End If

If tbnhap.Text = " Enter Number" Then

tbnhap.Text = " Find Entry by Location"

Exit Sub

End If

'vao menu con cua muc Message Setting

If tbnhap.Text = "Service Centre" Then

tbnhap.Text = "Voicemail Number"

Exit Sub

End If

If tbnhap.Text = "Expiry Period" Then

tbnhap.Text = "Service Centre"

Exit Sub

End If

If tbnhap.Text = "Outgoing Message Type" Then

tbnhap.Text = "Expiry Period"

Exit Sub

End If

If tbnhap.Text = "Voicemail Number" Then

tbnhap.Text = "Outgoing Message Type"

Exit Sub

End If

'vao menu con cua muc Outgoing Message Type

If tbnhap.Text = "Fax" Then

tbnhap.Text = "Text"

Exit Sub

End If

If tbnhap.Text = "X400" Then

tbnhap.Text = "Fax"

Exit Sub

End If

If tbnhap.Text = "Paging" Then

tbnhap.Text = "X400"

Exit Sub

End If

If tbnhap.Text = "Email" Then

tbnhap.Text = "Paging"

Exit Sub

End If

If tbnhap.Text = "ERMES" Then

tbnhap.Text = "Email"

Exit Sub

End If

If tbnhap.Text = "Voice" Then

tbnhap.Text = "ERMES"

Exit Sub

End If

If tbnhap.Text = "Text" Then

tbnhap.Text = "Voice"

Exit Sub

End If

'phan xu ly khi dung phim menu de di chuyen giua nhung tin nhan

If messagelist = True Then

Open filename4 For Random As #1 Len = Len(message)

banghi = LOF(1) Len(message)

If messagenumber = 1 Then

Get #1, banghi, message

tbnhap.Text = Trim(message.tin)

messagenumber = banghi

Else

messagenumber = messagenumber - 1

Get #1, messagenumber, message

tbnhap.Text = Trim(message.tin)

End If

Close #1

Exit Sub

End If

'nhung muc con cua Phone Setup

If tbnhap.Text = "Adjust Ring Volume" Then

tbnhap.Text = "Select Phone Line"

Exit Sub

End If

If tbnhap.Text = "Ring or Vibrate" Then

tbnhap.Text = "Adjust Ring Volume"

Exit Sub

End If

If tbnhap.Text = "Set Ringer Tone" Then

tbnhap.Text = "Ring or Vibrate"

Exit Sub

End If

If tbnhap.Text = "Set Ringer Tone 2" Then

tbnhap.Text = "Set Ringer Tone"

Exit Sub

End If

If line2 = True Then

If tbnhap.Text = "Phone Lock" Then

tbnhap.Text = "Set Ringer Tone 2"

Exit Sub

End If

Else

If tbnhap.Text = "Phone Lock" Then

tbnhap.Text = "Set Ringer Tone"

Exit Sub

End If

End If

If tbnhap.Text = "Change SIM PIN2 Code" Then

tbnhap.Text = "Phone Lock"

Exit Sub

End If

If tbnhap.Text = "New Security Code" Then

tbnhap.Text = "Change SIM PIN2 Code"

Exit Sub

End If

If tbnhap.Text = "Extended Menus" Then

tbnhap.Text = "New Security Code"

Exit Sub

End If

If extend = False Then

If tbnhap.Text = "Select Phone Line" Then

tbnhap.Text = "Extended Menus"

Exit Sub

End If

End If

'nhung menu mo rong khi extended menus o trang thai on

If extend = True Then

If tbnhap.Text = "Show Time and Date" Then

tbnhap.Text = "Extended Menus"

Exit Sub

End If

If tbnhap.Text = "Set Time and Date" Then

tbnhap.Text = "Show Time and Date"

Exit Sub

End If

If tbnhap.Text = "Set Time Format" Then

tbnhap.Text = "Set Time and Date"

Exit Sub

End If

If tbnhap.Text = "Battery Saving Mode" Then

tbnhap.Text = "Set Time Format"

Exit Sub

End If

If tbnhap.Text = "Select Keypad Tones" Then

tbnhap.Text = "Battery Saving Mode"

Exit Sub

End If

If tbnhap.Text = "Select Phone Line" Then

tbnhap.Text = "Select Keypad Tones"

Exit Sub

End If

End If

'vao menu con cua muc Select phone line

If tbnhap.Text = "Line 2" Then

tbnhap.Text = "Line 1"

Exit Sub

End If

If tbnhap.Text = "Line 1" Then

tbnhap.Text = "Line 2"

Exit Sub

End If

'vao menu con cua muc Ring or vibrate

If tbnhap.Text = "Vibrate Only" Then

tbnhap.Text = "Ring Only"

Exit Sub

End If

If tbnhap.Text = "Vibrate Then Ring" Then

tbnhap.Text = "Vibrate Only"

Exit Sub

End If

If tbnhap.Text = "No Ring or Vibrate" Then

tbnhap.Text = "Vibrate Then Ring"

Exit Sub

End If

If tbnhap.Text = "Ring Only" Then

tbnhap.Text = "No Ring or Vibrate"

Exit Sub

End If

'vao menu con cua muc Set Ringer Tone

If tbnhap.Text = "Music Tone" Then

tbnhap.Text = "Standard Tone"

Exit Sub

End If

If tbnhap.Text = "Standard Tone" Then

tbnhap.Text = "Music Tone"

Exit Sub

End If

'vao menu con cua muc Phone Lock

If tbnhap.Te

0