@@ -259,6 +259,8 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
259259 char name [18 ], * p , * q ;
260260 struct TASK * task = task_now ();
261261 int i , segsiz , datsiz , esp , dathrb ;
262+ struct SHTCTL * shtctl ;
263+ struct SHEET * sht ;
262264
263265 /*根据命令行生成文件名*/
264266 for (i = 0 ; i < 13 ; i ++ ) {
@@ -298,6 +300,14 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
298300 q [esp + i ] = p [dathrb + i ];
299301 }
300302 start_app (0x1b , 1003 * 8 , esp , 1004 * 8 , & (task -> tss .esp0 ));
303+ shtctl = (struct SHTCTL * ) * ((int * ) 0x0fe4 );
304+ for (i = 0 ; i < MAX_SHEETS ; i ++ ) {
305+ sht = & (shtctl -> sheets0 [i ]);
306+ if (sht -> flags != 0 && sht -> task == task ) {
307+ /*找到被应用程序遗留的窗口*/
308+ sheet_free (sht ); /*关闭*/
309+ }
310+ }
301311 memman_free_4k (memman , (int ) q , segsiz );
302312 } else {
303313 cons_putstr0 (cons , ".hrb file format error.\n" );
@@ -333,6 +343,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
333343 return & (task -> tss .esp0 );
334344 } else if (edx == 5 ) {
335345 sht = sheet_alloc (shtctl );
346+ sht -> task = task ;
336347 sheet_setbuf (sht , (char * ) ebx + ds_base , esi , edi , eax );
337348 make_window8 ((char * ) ebx + ds_base , esi , edi , (char * ) ecx + ds_base , 0 );
338349 sheet_slide (sht , 100 , 50 );
0 commit comments