MsgRec consistency
[lcore.git] / wcore.pas
index 928486fe97730f15347263baa3c0592372694108..1c063ada17a45f026c1757741d1259fbd5331e53 100755 (executable)
--- a/wcore.pas
+++ b/wcore.pas
@@ -1,8 +1,3 @@
-{ Copyright (C) 2005 Bas Steendijk and Peter Green\r
-  For conditions of distribution and use, see copyright notice in zlib_license.txt\r
-  which is included in the package\r
-  ----------------------------------------------------------------------------- }\r
-\r
 unit wcore;\r
 \r
 {\r
@@ -272,22 +267,17 @@ function MyWindowProc(
 var\r
     MsgRec : TMessage;\r
     a:integer;\r
-    handled:boolean;\r
 begin\r
   Result := 0;  // This means we handled the message\r
 \r
-  handled := false;\r
-\r
   {MsgRec.hwnd    := ahWnd;}\r
   MsgRec.wParam  := awParam;\r
   MsgRec.lParam  := alParam;\r
 \r
-  if (ahwnd = hwndwcore) then begin\r
-   dotasks;\r
-   case auMsg of\r
+  dotasks;\r
+  case auMsg of\r
     {$ifndef threadtimer}\r
     WM_TIMER: begin\r
-      handled := true;\r
       if msgrec.wparam = timerid_wcore then begin\r
         a := wcore_timehandler;\r
         killtimer(hwndwcore,timerid_wcore);\r
@@ -299,15 +289,14 @@ begin
     {WINMSG_TASK:dotasks;}\r
 \r
     WM_CLOSE: begin\r
-      handled := true;\r
+      {}\r
     end;\r
     WM_DESTROY: begin\r
-      handled := true;\r
+      {}\r
     end;\r
-   end;\r
+  else\r
+      Result := DefWindowProc(ahWnd, auMsg, awParam, alParam)\r
   end;\r
-\r
-  if not handled then Result := DefWindowProc(ahWnd, auMsg, awParam, alParam)\r
 end;\r
 \r
 \r
@@ -370,12 +359,13 @@ end;
 \r
 function ProcessMessage : Boolean;\r
 var\r
-    Msg : TMsg;\r
+    MsgRec : TMsg;\r
 begin\r
     Result := FALSE;\r
-    if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then begin\r
+    if PeekMessage(MsgRec, 0, 0, 0, PM_REMOVE) then begin\r
       Result := TRUE;\r
-      DispatchMessage(Msg);\r
+      TranslateMessage(MsgRec);\r
+      DispatchMessage(MsgRec);\r
     end;\r
 end;\r
 \r
@@ -386,3 +376,4 @@ end;
 \r
 \r
 end.\r
+\r