procedure TForm1.RecData;
var
Ch: array [0..80000] of Char;
MsgLen: LongInt;
Msg: string;
begin
MsgLen := GetMsg(@Ch[0],80000);
while MsgLen > 0 do
begin
if MsgLen > 80000 then
MsgLen := 80000;
SetLength(Msg, MsgLen);
Move(Ch[0], Msg[1], MsgLen);
if (Copy(Msg, 1, 2) <> '29') or CheckBox1.Checked then
Memo.Lines.Add(Msg);
MsgLen := GetMsg(@Ch[0],80000);
end;
end;
以上是delphi的源代码
下面是我写的vb的代码
ublic Sub recdata()
Dim msg As String * 8000
Dim msglen As Long
'msglen = Len(msg)
msglen = GetMsg(msg, 8000)
Do While msglen > 0
If msglen > 8000 Then
msglen = 8000
End If
msglen = Len(msg)
If (Mid(msg, 1, 2) <> "29") Or Combo2.SetFocus Then
List1.AddItem (msg)
msglen = GetMsg(msg, 8000)
End If
Loop
End Sub
总是报错,请各位帮帮忙,20分全给啦..
var
Ch: array [0..80000] of Char;
MsgLen: LongInt;
Msg: string;
begin
MsgLen := GetMsg(@Ch[0],80000);
while MsgLen > 0 do
begin
if MsgLen > 80000 then
MsgLen := 80000;
SetLength(Msg, MsgLen);
Move(Ch[0], Msg[1], MsgLen);
if (Copy(Msg, 1, 2) <> '29') or CheckBox1.Checked then
Memo.Lines.Add(Msg);
MsgLen := GetMsg(@Ch[0],80000);
end;
end;
以上是delphi的源代码
下面是我写的vb的代码
ublic Sub recdata()
Dim msg As String * 8000
Dim msglen As Long
'msglen = Len(msg)
msglen = GetMsg(msg, 8000)
Do While msglen > 0
If msglen > 8000 Then
msglen = 8000
End If
msglen = Len(msg)
If (Mid(msg, 1, 2) <> "29") Or Combo2.SetFocus Then
List1.AddItem (msg)
msglen = GetMsg(msg, 8000)
End If
Loop
End Sub
总是报错,请各位帮帮忙,20分全给啦..
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货