How to make a form as Always on Top

forum.td.development (2005-2010)
aleshk
Ukraine
Posts: 4
Joined: 05 Dec 2017, 07:40
Location: Kiev, Ukraine

How to make a form as Always on Top

Post by aleshk » 21 Oct 2009, 16:19

 Posted by:  Aleksandr Shkulepov 

Hi,

10 years ago I had working fuctionality which allowed us to make a form as
'Always on top' among all applications (not only Gupta forms).
We used WinAPI call:
SetWindowPos( hWnd, SalNumberToWindowHandle( HWND_TOPMOST), 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE )

I remember it worked on CTD 1.2 and 2.1.
Now when I am trying to reinstant that old piece of functionality on CTD 3.1
it does not work.
Did I forget or miss something?
Any hint?

Thanks,
Aleksandr

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1274
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

How to make a form as Always on Top

Post by Dave Rabelink » 21 Oct 2009, 19:25


aleshk
Ukraine
Posts: 4
Joined: 05 Dec 2017, 07:40
Location: Kiev, Ukraine

How to make a form as Always on Top

Post by aleshk » 21 Oct 2009, 21:42

 Posted by:  Aleksandr Shkulepov 

Hi Dave.

The function in your sample is completly the same as in my code.
But the sample's form becoms the topmost when my does not.
I have have started comparing differences... and found. It is funny and I
realy expected something similar :)

My form had 'Accessories Enabled'=Yes ('Tool Bar Visible'=No, 'Status Bar
Visible'=Yes)
As soon as I have set 'Accessories Enabled'=No everything began to work
properly in my case as well.

Thanks for the sample.

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1274
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

How to make a form as Always on Top

Post by Dave Rabelink » 25 Oct 2009, 11:01

Can you post the code of your sample which is not working?

aleshk
Ukraine
Posts: 4
Joined: 05 Dec 2017, 07:40
Location: Kiev, Ukraine

How to make a form as Always on Top

Post by aleshk » 25 Oct 2009, 11:29

 Posted by:  Aleksandr Shkulepov 

Hi Dave,

Just take the sample you have pointed to me and change 'Accessories Enabled'
of the form to YES.
Your sample form will not be the TopMost anymore.

BR,
Aleksandr

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1274
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

How to make a form as Always on Top

Post by Dave Rabelink » 26 Oct 2009, 21:27

The structure of the form is different when acc. are enabled.

Use this to get the actual top-form handle and then the TOPMOST
functionality works:

Set hWndWindow = FindWindowExA( hWndNULL, hWndNULL, "Gupta:AccFrame",
STRING_Null )

Call SetWindowPos( hWndWindow, SalNumberToWindowHandle( HWND_TOPMOST
), NUMBER_Null, NUMBER_Null, NUMBER_Null, NUMBER_Null, SWP_NOMOVE |
SWP_NOSIZE )

(I changed the sample, see attachment).
Beware, the classname has changed starting from TD2.0.
(on older versions the classname is 'Centura:AccFrame').

I will change the WIKI article to include this and create an updated
sample.

Regards,
Dave


Attachment: WIKI_SetTopMost.apt

Asgard

How to make a form as Always on Top

Post by Asgard » 27 Oct 2009, 12:06

 Posted by:  Asgard 


Into MDI de topmost don´t work

You have to handle wm_activate to change order and get "topmost"

Return to “td.development”

Who is online

Users browsing this forum: [Ccbot] and 0 guests