Solved

Smoothly Minimize

Posted on 1998-06-18
8
332 Views
Last Modified: 2010-04-03
Does anyone know, why (correct me if i'm wrong) Delphi Apps do not minimize smoothly, like other windows application?
Does it have to do with the use of either VBL or MFC?
Is there anything I can do?
0
Comment
Question by:kyr
8 Comments
 
LVL 3

Expert Comment

by:altena
ID: 1353677
The (real) main window is hidden in a delphi application. That explains what you are seeing.

If this is a real big problem: Buy a copy of Petzold's book
and start at winmain(). Then you have full control.
0
 
LVL 3

Expert Comment

by:vladika
ID: 1353678
See
procedure TApplication.Minimize;
begin
  if not IsIconic(FHandle) then
  begin
    NormalizeTopMosts;
    SetActiveWindow(FHandle);
    ShowWinNoAnimate(FHandle, SW_MINIMIZE);  !!!!!!!!!!!!  <- THIS IS CAUSE OF TROUBLE
    if Assigned(FOnMinimize) then FOnMinimize(Self);
  end;
end;


0
 

Author Comment

by:kyr
ID: 1353679
Bying a book to get a single tip makes experts-exchange useless.
A am not interested in learning all the low level work needed to create a form.

I am just asking for some lines of code that will do this for me.
0
 

Author Comment

by:kyr
ID: 1353680
Thanks very much for your efford anyway.
I will have in mind the book for the future.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:kyr
ID: 1353681
vladika,
Do you mean that all we have to do is to replace the default minimize routine with a custom one?
If you know details I would appreciate an answer.

kyriacos
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1353682
hi
0
 
LVL 3

Accepted Solution

by:
vladika earned 120 total points
ID: 1353683
I think Altena is right.
The problem is The main window is hidden.

Maybe It's not good solution, but ...

Copy forms.pas into your project directory and
modify TApplication.Minimize;

procedure TApplication.Minimize;
var SaveRect, MainRect: TRect;
begin
  if not IsIconic(FHandle) then
  begin
    NormalizeTopMosts;
    SetActiveWindow(FHandle);
    if MainForm <> nil then
    begin
      GetWindowRect(FHandle, SaveRect);
      GetWindowRect(MainForm.Handle, MainRect);
      SetWindowPos(FHandle, 0, MainRect.Left, MainRect.Top, MainRect.Right-MainRect.Left, MainRect.Bottom-MainRect.Top, 0);
      ShowWindow(FHandle, SW_MINIMIZE);
      SetWindowPos(FHandle, 0, SaveRect.Left, SaveRect.Top, SaveRect.Right-SaveRect.Left, SaveRect.Bottom-SaveRect.Top, 0);
    end else
      ShowWinNoAnimate(FHandle, SW_MINIMIZE);
    if Assigned(FOnMinimize) then FOnMinimize(Self);
  end;
end;


0
 

Author Comment

by:kyr
ID: 1353684
thanx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi with SQL Natvie Client 15 86
oracle global variables 4 63
drawing animated level bar based on numbers 3 88
Firemonkey DbLookupComboBox equivalent ? 2 34
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now