From d63fdd677fc6ab221d92999630627bd1a0b8afd4 Mon Sep 17 00:00:00 2001 From: beware Date: Wed, 10 Nov 2010 23:20:43 +0000 Subject: [PATCH] allow wcore to coexist with other windows git-svn-id: file:///svnroot/lcore/trunk@89 b1de8a11-f9be-4011-bde0-cc7ace90066a --- wcore.pas | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/wcore.pas b/wcore.pas index d15e803..928486f 100755 --- a/wcore.pas +++ b/wcore.pas @@ -272,17 +272,22 @@ function MyWindowProc( var MsgRec : TMessage; a:integer; + handled:boolean; begin Result := 0; // This means we handled the message + handled := false; + {MsgRec.hwnd := ahWnd;} MsgRec.wParam := awParam; MsgRec.lParam := alParam; - dotasks; - case auMsg of + if (ahwnd = hwndwcore) then begin + dotasks; + case auMsg of {$ifndef threadtimer} WM_TIMER: begin + handled := true; if msgrec.wparam = timerid_wcore then begin a := wcore_timehandler; killtimer(hwndwcore,timerid_wcore); @@ -294,14 +299,15 @@ begin {WINMSG_TASK:dotasks;} WM_CLOSE: begin - {} + handled := true; end; WM_DESTROY: begin - {} + handled := true; end; - else - Result := DefWindowProc(ahWnd, auMsg, awParam, alParam) + end; end; + + if not handled then Result := DefWindowProc(ahWnd, auMsg, awParam, alParam) end; @@ -367,7 +373,7 @@ var Msg : TMsg; begin Result := FALSE; - if PeekMessage(Msg, hwndwcore, 0, 0, PM_REMOVE) then begin + if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then begin Result := TRUE; DispatchMessage(Msg); end; -- 2.30.2