运行至A点,lDeviceType, lBaud都被赋值了,但是至B点取不到
看watchlist窗口说是由于优化无法读取了>.<现在偶用的笨办法是声明全局变量>.<procedure TForm1.Button1Click(Sender: TObject);
var
lDeviceType, lBaud, comstate: Longint;
begin
lDeviceType := ComboBox2.ItemIndex;
lPort := ComboBox1.ItemIndex + 1;
case ComboBox3.ItemIndex of
0:
lBaud := 9600;
1:
lBaud := 38400;
2:
lBaud := 57600;
3:
lBaud := 152000; ///A
end;comstate := MITOpenComm(lDeviceType, 0, lPort, lBaud, 15); ///B
case comstate of
0:
Application.MessageBox('初始化成功', 'MITSMS', MB_OK);
-1:
Application.MessageBox('连接串口失败', 'MITSMS', MB_OK);
-2:
Application.MessageBox('初始化红外连接错误', 'MITSMS', MB_OK);
-3:
Application.MessageBox('检测不到设备', 'MITSMS', MB_OK);
-4:
Application.MessageBox('加密狗错误', 'MITSMS', MB_OK);
end;end;
看watchlist窗口说是由于优化无法读取了>.<现在偶用的笨办法是声明全局变量>.<procedure TForm1.Button1Click(Sender: TObject);
var
lDeviceType, lBaud, comstate: Longint;
begin
lDeviceType := ComboBox2.ItemIndex;
lPort := ComboBox1.ItemIndex + 1;
case ComboBox3.ItemIndex of
0:
lBaud := 9600;
1:
lBaud := 38400;
2:
lBaud := 57600;
3:
lBaud := 152000; ///A
end;comstate := MITOpenComm(lDeviceType, 0, lPort, lBaud, 15); ///B
case comstate of
0:
Application.MessageBox('初始化成功', 'MITSMS', MB_OK);
-1:
Application.MessageBox('连接串口失败', 'MITSMS', MB_OK);
-2:
Application.MessageBox('初始化红外连接错误', 'MITSMS', MB_OK);
-3:
Application.MessageBox('检测不到设备', 'MITSMS', MB_OK);
-4:
Application.MessageBox('加密狗错误', 'MITSMS', MB_OK);
end;end;
解决方案 »
- RzToolButton按钮风格问题
- 请高手解决棘手老问题 《tif文件合并和分割问题》在线等待。。。急急急(分不够可再开贴加)
- 一搜,欢乐搜索,一百万奖品,是真的吗?
- 连接问题,你遇到过吗,有点棘手
- 各位大哥,这是我写的一点东西,来看一下
- 怎样实现如下报表的格式。 一页不满指定行则以空行补上,
- 我需要一个dbgrid类控件可以有多行表头,有什么好建议吗?(不要dbgrideh)
- 请问一个用Delphi开发的Internet网络通讯的问题?
- 高分征集算法题,如果您有这样的题,请跟贴吧!
- dbgrid中我想在添加记录时只能选择几个固定的值。听说sql语句可以实现,我不知道怎么写!
- 关于分辨率的问题……急!!
- 哪位大侠对于pageproducer有开发经验的,介绍介绍吧!
自动优化会让在你调试时看不到值而已。
在B点之前用showmessage看看?
例如:
...
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
***在这里声明***
end;
...