Browse Source

* window class is registered only once => multible init/closegraphs are possible
* calling cleardevice when creating the window

florian 25 years ago
parent
commit
cf42fe5f4f
1 changed files with 22 additions and 8 deletions
  1. 22 8
      rtl/win32/graph.inc

+ 22 - 8
rtl/win32/graph.inc

@@ -428,8 +428,8 @@ begin
 
 
   hWindow := CreateWindow('MyWindow', windowtitle,
   hWindow := CreateWindow('MyWindow', windowtitle,
               ws_OverlappedWindow, 50, 50,
               ws_OverlappedWindow, 50, 50,
-              maxx+2*GetSystemMetrics(SM_CXBORDER),
-              maxy+2*GetSystemMetrics(SM_CYBORDER)+
+              maxx+1+2*GetSystemMetrics(SM_CXBORDER),
+              maxy+1+2*GetSystemMetrics(SM_CYBORDER)+
                 GetSystemMetrics(SM_CYCAPTION),
                 GetSystemMetrics(SM_CYCAPTION),
               0, 0, system.MainInstance, nil);
               0, 0, system.MainInstance, nil);
 
 
@@ -441,16 +441,24 @@ begin
   wincreate:=hWindow;
   wincreate:=hWindow;
 end;
 end;
 
 
+const
+   winregistered : boolean = false;
+
 function MessageHandleThread(p : pointer) : DWord;StdCall;
 function MessageHandleThread(p : pointer) : DWord;StdCall;
 
 
   var
   var
      AMessage: Msg;
      AMessage: Msg;
 
 
   begin
   begin
-     if not WinRegister then begin
-       MessageBox(0, 'Register failed', nil, mb_Ok);
-       ExitThread(1);
-     end;
+     if not(winregistered) then
+       begin
+          if not WinRegister then
+            begin
+               MessageBox(0, 'Register failed', nil, mb_Ok);
+               ExitThread(1);
+            end;
+          winregistered:=true;
+       end;
      MainWindow := WinCreate;
      MainWindow := WinCreate;
      if longint(mainwindow) = 0 then begin
      if longint(mainwindow) = 0 then begin
        MessageBox(0, 'WinCreate failed', nil, mb_Ok);
        MessageBox(0, 'WinCreate failed', nil, mb_Ok);
@@ -480,7 +488,9 @@ procedure InitWin32GUI16colors;
        GetExitCodeThread(MessageThreadHandle,@threadexitcode);
        GetExitCodeThread(MessageThreadHandle,@threadexitcode);
      until graphrunning or (threadexitcode<>STILL_ACTIVE);
      until graphrunning or (threadexitcode<>STILL_ACTIVE);
      if threadexitcode<>STILL_ACTIVE then
      if threadexitcode<>STILL_ACTIVE then
-       _graphresult := grerror;
+        _graphresult := grerror
+     else
+       ClearDevice;
   end;
   end;
 
 
 procedure CloseGraph;
 procedure CloseGraph;
@@ -721,7 +731,11 @@ function queryadapterinfo : pmodeinfo;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2000-03-05 13:06:32  florian
+  Revision 1.8  2000-03-17 22:53:20  florian
+    * window class is registered only once => multible init/closegraphs are possible
+    * calling cleardevice when creating the window
+
+  Revision 1.7  2000/03/05 13:06:32  florian
     * the title can be user defined
     * the title can be user defined
 
 
   Revision 1.6  2000/01/07 16:41:52  daniel
   Revision 1.6  2000/01/07 16:41:52  daniel