Solved

Smoothly Minimize

Posted on 1998-06-18
8
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

0
 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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