Recent

Author Topic: Restoring minimized screens Delphi 6 / Windows 10  (Read 1003 times)

Nico

  • Newbie
  • Posts: 2
Restoring minimized screens Delphi 6 / Windows 10
« on: January 17, 2025, 05:57:08 pm »
Hello all,

I'm having a problem which might be related to running Delphi 6 on a Windows 10 system.  Here's the problem :
I have an application containing a menu system with in total about 60 screens. All screens are created with the default values as given by Delphi.
The only screen I can restore and get back again, is the front page with the menu system. Any other screen is not restored.

I've searche stackoverflow and others, and I am obviously not the only one.
I therefore wonder if LAZARUS does it right. If so I'll be tempted to convert the application to Lazarus.

Any reactions would be appreciatred greatly

All the best
Nico in Denmark

Thaddy

  • Hero Member
  • *****
  • Posts: 16520
  • Kallstadt seems a good place to evict Trump to.
Re: Restoring minimized screens Delphi 6 / Windows 10
« Reply #1 on: January 17, 2025, 06:31:25 pm »
Well, D6 was unusable anyway. (notoriously unstable)
Why do you still use it?

Why do you ask on a Lazarus forum? From the information given it seems that the sourcecode is simply not adequate for more modern windows versions. And if it uses 60! forms with Delphi defaults it is also badly written.(I interpreted it like the forms are not created dynamically, but all in one go in the dpr file)
If that is the case, translating the application to Lazarus won't help you very much.
« Last Edit: January 17, 2025, 06:41:17 pm by Thaddy »
But I am sure they don't want the Trumps back...

Nico

  • Newbie
  • Posts: 2
Re: Restoring minimized screens Delphi 6 / Windows 10
« Reply #2 on: January 18, 2025, 10:01:36 am »
Thanks for your opinion. I'm using Delphi because it was available, and nearing 80, I hesitate to invest in something newer. I might not even finish the project... :-)
Anyway, thanks
/Nico

jamie

  • Hero Member
  • *****
  • Posts: 6801
Re: Restoring minimized screens Delphi 6 / Windows 10
« Reply #3 on: January 18, 2025, 03:56:47 pm »
Do not minimize all those forms to the task bar, hide them until needed and then use show and or bringtofront.
 So by default all secondary forms should be invisible and make sure the form boundaries fit the current screen.

 Also make sure they are in the auto created list.
The only true wisdom is knowing you know nothing

Bart

  • Hero Member
  • *****
  • Posts: 5510
    • Bart en Mariska's Webstek
Re: Restoring minimized screens Delphi 6 / Windows 10
« Reply #4 on: January 18, 2025, 04:30:02 pm »
Could you create (in Delphi 6) a sample application with, let's say) just 3 or 4 "screens" and see if you can replicate the problem?
If so, you can post the project (sources only, zipped) here and we can see what's wrong, and see if it would behave better in Lazarus. 

I hope I'll still be programming when I'm 80  8-)

Bart

Soner

  • Sr. Member
  • ****
  • Posts: 318
Re: Restoring minimized screens Delphi 6 / Windows 10
« Reply #5 on: January 18, 2025, 09:41:16 pm »
You can do this:
Code: Pascal  [Select][+][-]
  1. // In Mainforms OnCreate
  2. procedure TForm1.FormCreate(Sender: TObject);
  3. begin
  4.   Application.OnRestore:=@AppOnRestore;
  5. end;    
  6.  
  7. procedure TForm1.AppOnRestore(Sender: TObject);
  8. var i: integer;
  9. begin
  10.   for i:=0 to Application.ComponentCount-1 do
  11.     if (Application.Components[i] is TCustomForm) then //maybe add this to allow for Mainform maximize: and(Application.Components[i]<>Application.MainForm)
  12.        (Application.Components[i] as TCustomForm).WindowState:=wsNormal;
  13. end;  
  14.  

 

TinyPortal © 2005-2018