请高手帮忙把VB程序转成delphi语言
PrivateSubCommand3_Click(IndexAsInteger)Ifdenglu.MSComm1.PortOpen=FalseThendenglu.MSC...
Private Sub Command3_Click(Index As Integer)
If denglu.MSComm1.PortOpen = False Then
denglu.MSComm1.PortOpen = True
End If
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT" & Chr(13) '
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CMGF=0" & Chr(13)
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CNMI=2,1,0,0,0" & Chr(13)
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CSCS=" + Chr(34) + "UCS2" + Chr(34) & Chr(13)
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CSMP=,,,8" & Chr(13)
init_STA = True
If denglu.Timer1.Enabled = False Then
denglu.Timer1.Enabled = True
End If
End Sub
下面是函数的定义
Public Const MAX_AT_index = 20
Public ATCMD_ARRAY(MAX_AT_index) As String
Public AT_index As Byte
Public init_STA As Boolean 展开
If denglu.MSComm1.PortOpen = False Then
denglu.MSComm1.PortOpen = True
End If
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT" & Chr(13) '
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CMGF=0" & Chr(13)
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CNMI=2,1,0,0,0" & Chr(13)
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CSCS=" + Chr(34) + "UCS2" + Chr(34) & Chr(13)
AT_index = (AT_index + 1) Mod MAX_AT_index
ATCMD_ARRAY(AT_index) = "AT+CSMP=,,,8" & Chr(13)
init_STA = True
If denglu.Timer1.Enabled = False Then
denglu.Timer1.Enabled = True
End If
End Sub
下面是函数的定义
Public Const MAX_AT_index = 20
Public ATCMD_ARRAY(MAX_AT_index) As String
Public AT_index As Byte
Public init_STA As Boolean 展开
1个回答
展开全部
//-因刚重装系统没来得及装DELPHI, 谅解-//
//-疑问1: AT_index=?--//
//--------首先在 type 增加 ShellAPI--------//
procedure Botton1.clik(Sender: TObject)
//--------定义变量--------//
var
MAX_AT_index: Interger;
ATCMD_ARRAY(MAX_AT_index): String;
//--------可能不是Byte--------//
AT_index: Byte;
init_STA: Boolean;
begin
//--------MAX_AT_index赋值--------//
MAX_AT_index:= 20;
//--------建立COM口通讯--------//
if denglu.MSComm1.PortOpen= False then
denglu.MSComm1.PortOpen:= Ture;
//--------以下不懂 & 不会--------//
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT' & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CMGF=0' & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CNMI=2,1,0,0,0' & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CSCS=' + Chr(34) + 'UCS2' + Chr(34) & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CSMP=,,,8' & Chr(13);
//--------变量赋值--------//
init_STA:= True;
//--------激活TTimer控件--------//
If denglu.Timer1.Enabled= False Then
denglu.Timer1.Enabled:= True;
end;
//-疑问1: AT_index=?--//
//--------首先在 type 增加 ShellAPI--------//
procedure Botton1.clik(Sender: TObject)
//--------定义变量--------//
var
MAX_AT_index: Interger;
ATCMD_ARRAY(MAX_AT_index): String;
//--------可能不是Byte--------//
AT_index: Byte;
init_STA: Boolean;
begin
//--------MAX_AT_index赋值--------//
MAX_AT_index:= 20;
//--------建立COM口通讯--------//
if denglu.MSComm1.PortOpen= False then
denglu.MSComm1.PortOpen:= Ture;
//--------以下不懂 & 不会--------//
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT' & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CMGF=0' & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CNMI=2,1,0,0,0' & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CSCS=' + Chr(34) + 'UCS2' + Chr(34) & Chr(13);
AT_index:= (AT_index + 1) Mod MAX_AT_index;
ATCMD_ARRAY(AT_index):= 'AT+CSMP=,,,8' & Chr(13);
//--------变量赋值--------//
init_STA:= True;
//--------激活TTimer控件--------//
If denglu.Timer1.Enabled= False Then
denglu.Timer1.Enabled:= True;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询