Form always visible

1

Well, I came here because I do not know what to do anymore, I tried everything ... I need to leave my FORM2 always visible (above) of all open programs on windows. My program did the following:

Form1 has a BUTTON when I click on it it executes the following command:

Form2.Show;

In the ONSHOW of FORM2 I put the following:

 SetWindowPos(Form2.handle, HWND_TOPMOST, Form2.Left, Form2.Top,Form2.Width, Form2.Height, 0);

And the FormStyle property of Form2, I changed it to fsStayOnTop. Even so, when I call FORM2, it's no use, it's not always visible, if I open WORD for example, it's already behind. What am I doing wrong ? Any idea ?

    
asked by anonymous 21.07.2014 / 04:20

3 answers

3

impossible to do that . Not only in Delphi, but in any application. Imagine if two applications did this . You would have two windows marked to always be as always visible and then how would you decide which one to display?

Other things are possible. For example, get top of the 3D flip animation of Windows 7 or stay on top even when other windows of your software are open .

    
22.07.2014 / 20:00
0

I know it's an old question but I'll leave my contribution here.

We imagine that you have a form menu as the main form, if you want all open forms always to be in front of the main form (menu) just put the following code in the form of the form and leave FormStyle = Normal

Add to Create:

SetWindowPos(Self.handle, HWND_TOPMOST, Self.Left, Self.Top, Self.Width, Self.Height, 0);

If you want the form to be in front of everything, including other programs just change the form's ownership to.

FormStyle = fsStayOnTop

Use Form.ShowModal instead of Show so that it stays above all others in the project, but you will not have access to the forms that are behind.

    
31.05.2017 / 15:51
-1

For the form to be normal use the function ShowModal (Form2.ShowModal), in this way you pass the control to form2.

    
29.01.2016 / 07:00