Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
CnVCL 组件包
» CnModem错误报告
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: CnModem错误报告
zj_yqj
新警察
UID 2638
Digest Posts 0
Credits 27
Posts 9
点点分 27
Reading Access 10
Registered 2006-9-28
Status Offline
#1
Post at 2009-3-28 10:08
Profile
|
Blog
|
P.M.
CnModem错误报告
procedure TCnModem.Escape;
var
Tick: Integer;
begin
if CommOpened and (ModemState = msOnline) then
begin
Tick := Round(FWaitEscapeTime * 0.02 * 1.3);
Sleep(Tick);
WriteATCommand('+++', False);
Sleep(Tick);
ModemState := msOnlineCommand;
end;
end;
这里的0.02应该为20.因为下面的Sleep中的单位是毫秒。
zj_yqj
新警察
UID 2638
Digest Posts 0
Credits 27
Posts 9
点点分 27
Reading Access 10
Registered 2006-9-28
Status Offline
#2
Post at 2009-3-28 12:10
Profile
|
Blog
|
P.M.
function TCnModem.WaitATResult(Delay: Cardinal): string;
var
Tick: Cardinal;
begin
FWaitATResult := True;
try
FATResult := '';
Tick := GetTickCount;
while (GetTickCount - Tick < Delay) and (FATResult = '') do
Application.ProcessMessages;
Result := FATResult;
FATResult := '';
finally
FWaitATResult := False;
end;
end;
Application.ProcessMessages;
后面要加一行
Sleep(1);
否则等待时CPU打满了了
zjy
管理员
UID 2
Digest Posts
6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
#3
Post at 2009-3-28 19:42
Profile
|
Site
|
Blog
|
P.M.
感谢报告!
0.02 的问题估计是当初疏忽,刚才看到 SkyJacker 写的 Demo 里也提到了这个疑问,已改为 20。
ProcessMessages 修改为 HandleMessage,后者会调用 Idle,比 Sleep 更规范。
已提交 CVS,有空请验证。
Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 07:05
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.008500 second(s), 8 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats