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
Solved

Smoothly Minimize

Posted on 1998-06-18
8
334 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 96
LAN or WAN ? 11 95
control image tags in a string ? 12 141
can i put an image from resource into image tag ? 6 26
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 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