Display on top of windows applications


is there a way to keep my application on top of other running applications (none-clarion apps)?

I am using VuFiletools template for this but still I have to ship the VU DLL with it.


Set­Window­Pos() with HWND_TOP­MOST

Code example in the 2nd post here
Clarion, Window always in the top. (computer-programming-forum.com)

You might also want to look at the WinExt class (WinExt.inc, .clw & svapi.inc). It primarily add’s a systray icon and functionality to the main frame window, but in the svapi.inc file are the Window Style Ex equates including WS_EX_TOPMOST. I havent looked in detail, but you might be able to pass that equate to the main frame using this template, but dont quote me, I’ve not looked at it in the debugger so cant say for sure if it can be done or not, but it might be possible to access the window styles and alter them.


I tried this and it worked fine. thank you for the guidance.





MSDN on WS_EX_TOPMOST says to " To add or remove this style, use the SetWindowPos function"

But if you look at WS_EX_PALETTEWINDOW, its a window style that can be used when creating the window and that has TopMost as a property right from the start and the sample code at the very top of your link is using a Create window api, again suggesting it can be used right from the start.

I know MS are suggesting SetWindowPos as a way to toggle that window style, but I’m not convinced TopMost cant be a property when the window is created because of the PalletteWindow properties, but also the fact TopMost is available to use with windows in VB.net
Form.TopMost Property (System.Windows.Forms) | Microsoft Learn

Clarion developers use Open(window) probably 99.9999% of the time not CreateWindow. I think I’ve only used it for controls.

If the Window has been created, then SetWindowPos() is the documented way. It must shuffle Z order and send messages to put the already created window on top.

Yeah and I wasnt talking about Open(window) I was talking about the WinExt template and how there might be a way to use the TopMost equate, but I’ve not investigated that template or class.