INTTOHEX(RBUF[I], 2);
136 end;
137 mmMsg.Lines.Add('MsgReceived[' + S + ']');
138 end;
139 //var
140 // tmpArray: array[0..4096] of Byte;
141 // i: DWORD;
142 // tmpStr: string;
143 // pStr: PChar;
144 //begin
145 // pStr := Buffer;
146 // tmpStr := string(pStr);
147 // mmMsg.Lines.Add(tmpStr);
148 // Dec(PStr);
149 // for i := 0 to Length(tmpStr) - 1 do
150 // begin
151 // inc(PStr);
152 // tmpArray[i] := Byte(PSTR^);
153 // mmMsg.Lines.Add(IntToHEX(Ord(tmpArray[i]), 2));
154 // end;
155 // exit;
156 // pStr := Buffer;
157 // mmMsg.Lines.Add(pStr);
158 //end;
159
160 procedure TMainFrm.advBtnConfirmClick(Sender: TObject);
161 begin
162 if mmSendMsg.Lines.Count <= 0 then
163 begin
164 Application.MessageBox('There is no key word, please check the MsgSendList,thanks.', 'Error Information', MB_OK + MB_ICONSTOP);
165 mmSendMsg.SetFocus;
166 Exit;
167 end;
168 if cbByte.Checked then
169 begin
170 SendHex(mmSendMsg.Text);
171 end
172 else
173 begin
174 comMain.WriteCommData(PChar(mmSendMsg.Text), Length(mmSendMsg.Text));
175 end;
176 if (cbAutoSend.Checked) and (edtTime.Text <> '') and (cbByte.Checked) then
177 begin
178 timerMain.Interval := StrToInt(edtTime.Text);
179 timerMain.Enabled := True;
180 end;
181 end;
182
183 procedure TMainFrm.AdvGlassButton1Click(Sender: TObject);
184 begin
185 timerMain.Enabled := False;
186 gbSendMsg.Enabled := False;
187 cbByte.Checked := False;
188 cbAutoSend.Checked := False;
189 edtTime.Text := '';
190 mmMsg.Text := '';
191 mmSendMsg.Text := '';
192 comMain.StopComm;
193 connectStatus.Caption := 'Not Connected';
194 connectStatus.FillColor := clRed;
195 advBtnConnect.Enabled := True;
196 end;
197
198 procedure TMainFrm.timerMainTimer(Sender: TObject);
199 begin
200 SendHex(mmSendMsg.Text);
201 end;
202
203 end.
|