Form always visible

Asked

Viewed 1,786 times

2

Good people, I came here because I don’t know what else to do, I tested everything.... need to make my FORM2 always visible (above) of all open programs in windows. My program did as follows:

Form1 has a BUTTON when I click 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 is no use, it is not always visible, if I open WORD for example, it is already behind. What am I doing wrong? Any ideas ?

  • recommend taking a look at this OS question (http://stackoverflow.com/questions/12946150/how-to-bring-my-application-to-the-front), some of the answers to ways of doing may suit you. But 100% functioning none of them guaranteed.

3 answers

4


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 the open Forms to be always in front of the main form( menu ) just put in the create of the children Forms the code below and leave the 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 property to.

FormStyle = fsStayOnTop

Utilize Form.ShowModal instead of Show so that it stays on all the others of the project, but you will not have access to the Forms that are behind.

-1

To make the form normal use the function Showmodal (Form2.Showmodal), this way you pass the control to the form2.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.