继续话题:多煤体定时器的疑惑(10分)

M

mayong

Unregistered / Unconfirmed
GUEST, unregistred user!
我试了利用多煤体定时器,可以实现精确定时,在此谢谢茶叶蛋和CJ先生!!
但当用于控件时,每当时间时间到而执行以下代码(控件的Public声明),
定时事件马上不工作. 各位大虾,帮忙分析???

procedure TARollor.TimeTick;
begin //
if FTimerTickEnable=False then exit;
if Assigned(FContinueEvent) then FContinueEvent(Self);
if FInvert then
BitBlt(Canvas.Handle,0,0,FBitmap.Width,FBitmap.Width,
FBitmap.Canvas.Handle,
0,FData*FBitmap.Width+Inci,NOTSRCCOPY)
else
BitBlt(Canvas.Handle,0,0,FBitmap.Width,FBitmap.Width,
FBitmap.Canvas.Handle,
0,FData*FBitmap.Width+Inci,SRCCOPY);
inc(Inci);
end;
 
Delphi_Help中注明:
Applications should not call any system-defined functions from
inside a callback function, except for PostMessage,
timeGetSystemTime, timeGetTime, timeSetEvent, timeKillEvent,
midiOutShortMsg, midiOutLongMsg, and OutputDebugString.
上述函数中有system-defined functions吗?
如何解决?
 
I didn't not know which use of your timer.
You know the timer is not exact.
 
我没有使用任何有关Timer的控件(我也没有),我用了如下代码
结果如上所说...

procedure DMTTimer(uID,uMsg:UINT; dwUser,dw1,dw2:DWORD);
begin
Form1.ARollor1.TimeTick;//调用电度表控件的public procedure
end;
procedure TForm1.FormCreate(Sender: TObject);
var
TimerProc:TFNTimeCallBack;//DMTTimerProc;
begin
TimerProc:=DMTTimer;
Uid:=TimeSetEvent(100,1000,@TimerProc,0,TIME_PERIODIC);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
TimeKillEvent(Uid);
end;
 
据我作知,Windows下的定时器发的定时消息WM_TIMER只是发到应用
程序的消息队列,至于应用程序什么时候处理她,还要看其他的消息
的处理情况,如果前一个消息导致系统的崩溃。那么,这个消息将不会
被处理。
仅仅个人的认为,见笑!
 
Agree with Eldorado!
 
system-defined functions是不是指全部Win32API啊?
如果是的话,bitblt应该算是一个把.
 
system-defined functions是不是指全部Win32API啊?
如果是的话,bitblt应该算是一个把.
 
接受答案了.
 

Similar threads

顶部