'With decode encode
Function analyze (recmsg as string) as Boolean
Dim Tel as string, MSG as string, time as string
Analyze = analyzerecmsg (buffer, tel, MSG, time)
If analyze = true then
'User Processing
Mobiletel. Text = Tel
Sendmsg. Text = msg
'Label1.caption = Time
End if
End Function
Public Function analyzerecmsg (byval recmsg as string, byref mobilenumber as string, byref MSG as string, byref msgtime as string) as Boolean
Dim I as integer, J as integer
Dim analyzemsg as string
Dim length as integer
Analyzerecmsg = false
I = instr (recmsg, "+ cmgr :")
If I length then
MSG = decode (MSG)
End if
Analyzerecmsg = true
End Function
'================================================ ======================================
'The following is a set of Chinese character encoding and decoding functions.
Public Function encode (txtmessage as string) as string
Dim high as string, low as string, oneword as string
Dim I as integer
For I = 1 to Len (txtmessage) 'converts the short message into Encoding
Oneword = mid (txtmessage, I, 1)
Low = hex (ASCB (midb (oneword, 1, 1 )))
High = hex (ASCB (midb (oneword, 2, 1 )))
If Len (high) = 1 then high = "0" + high
If Len (low) = 1 then low = "0" + low
Encoding obtained by encode = encode + high + low
Next I
End Function
Public Function decode (encodemessage as string) as string
Dim word (2) as byte
Dim ASCII as string
Dim temp as string
Dim J as integer, POS as integer
Pos = 1
J = 1
Do
If j> = Len (encodemessage) then
Exit Function
End if
ASCII = mid (encodemessage, J, 2)
J = J + 2
Word (POS) = Val ("& H" + ASCII)
Pos = pos-1
If Pos = "0" and oneword "" Then exit function
Else
If oneword = "" then
Do
I = I + 1
Oneword = mid (recdecodemsg, I, 1)
Loop while oneword = "" and I
Next article:Compilation of assembly language command parameter programs