X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/4782a5c5afee47721cc617daa40dd29828342c2b..31d4361fb52761b6486f55af10268a51ee536a6f:/wcore.pas?ds=inline diff --git a/wcore.pas b/wcore.pas index 40505ef..e79fc10 100755 --- a/wcore.pas +++ b/wcore.pas @@ -1,8 +1,3 @@ -{ Copyright (C) 2005 Bas Steendijk and Peter Green - For conditions of distribution and use, see copyright notice in zlib_license.txt - which is included in the package - ----------------------------------------------------------------------------- } - unit wcore; { @@ -30,6 +25,9 @@ interface end; tltimer=class(tlcomponent) + private + fenabled : boolean; + procedure setenabled(newvalue : boolean); public ontimer:tnotifyevent; initialevent:boolean; @@ -37,8 +35,8 @@ interface prevtimer:tltimer; nexttimer:tltimer; interval:integer; {miliseconds, default 1000} - enabled:boolean; nextts:integer; + property enabled:boolean read fenabled write setenabled; constructor create(aowner:tcomponent);override; destructor destroy;override; end; @@ -60,9 +58,10 @@ procedure addtask(ahandler:ttaskevent;aobj:tobject;awparam,alparam:longint); procedure disconnecttasks(aobj:tobject); procedure exitmessageloop; procedure processmessages; +procedure wcoreinit; var - onshutdown:procedure(s:string); + onshutdown:procedure(s:ansistring); implementation @@ -96,6 +95,13 @@ end; {------------------------------------------------------------------------------} +procedure tltimer.setenabled(newvalue : boolean); +begin + fenabled := newvalue; + nextts := 0; + initialdone := false; +end; + constructor tltimer.create; begin inherited create(AOwner); @@ -307,11 +313,8 @@ var lpszMenuName : nil; lpszClassName : 'wcoreClass'); -procedure messageloop; -var - MsgRec : TMsg; +procedure wcoreinit; begin - if Windows.RegisterClass(MyWindowClass) = 0 then halt; //writeln('about to create wcore handle, hinstance=',hinstance); hwndwcore := CreateWindowEx(WS_EX_TOOLWINDOW, @@ -334,6 +337,14 @@ begin {$endif} +end; + +procedure messageloop; +var + MsgRec : TMsg; + +begin + while GetMessage(MsgRec, 0, 0, 0) do begin TranslateMessage(MsgRec); DispatchMessage(MsgRec); @@ -354,12 +365,13 @@ end; function ProcessMessage : Boolean; var - Msg : TMsg; + MsgRec : TMsg; begin Result := FALSE; - if PeekMessage(Msg, hwndwcore, 0, 0, PM_REMOVE) then begin + if PeekMessage(MsgRec, 0, 0, 0, PM_REMOVE) then begin Result := TRUE; - DispatchMessage(Msg); + TranslateMessage(MsgRec); + DispatchMessage(MsgRec); end; end; @@ -370,3 +382,4 @@ end; end. +