请高手帮忙把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
展开
 我来答
改润0iT58e
2010-05-21 · TA获得超过721个赞
知道小有建树答主
回答量:823
采纳率:80%
帮助的人:539万
展开全部
//-因刚重装系统没来得及装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;
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式