..graphics overlay always on the top..

BlitzMax Forums/BlitzMax Programming/..graphics overlay always on the top..

Naughty Alien(Posted 2015) [#1]
..hi guys..i want to draw some graphics overlay, over other application which runs, all the time and overlay stays on the top regardless user intervention with mouse or any other way..how to do this with BMX ?


Xerra(Posted 2015) [#2]
This for a gui program or something running in a screen?

If it's the later then what you need to be drawn on top should just be the last thing you display before flipping.


Derron(Posted 2015) [#3]
Other applications ... I think he talks about stuff like the fps-overlay of "fraps".


bye
Ron


Naughty Alien(Posted 2015) [#4]
Yes. I want to have logo or some other graphics over screen all the time, regardless what application runs on pc. Its needed for some alert screens system on local airports. Im not sure is that thread for maxgui or not.


Xerra(Posted 2015) [#5]
Ah missed that. Skim-reading as I'm bored at work. I'll leave this one to someone more knowledgeable than myself then.


Brucey(Posted 2015) [#6]
Can't you make an always-on-top app that displays an image on a transparent window?


Naughty Alien(Posted 2015) [#7]
..applictions which runs are many, and not done by me..so I need to create application which displays specific logo (based on request) over anything running at given moment..im not sure i understand what you saying Brucey..how can i make 'always on the top' app ??


Derron(Posted 2015) [#8]
As you cannot guarantee to be the "topmost" app all time (what about multiple "stay on top" apps fighting each other?) the most secure way is to have some kind of custom video driver.

Alternatively you will have to be able to grab every kind of graphics context (gdi, dx, opengl ...) or more specifically "hook into them"

Maybe use some kind of lib for this
http://taksi.sourceforge.net/


If all apps on the screen just use "GDI" (no graphical contexts like gl/dx) you could create a fullscreen GDI ("maxgui") app.

Newer windows incarnations have transparent window support (I think older ones had trouble - so win98 and so on).

Create your windows with two more flags: WS_EX_LAYERED and WS_EX_TRANSPARENT. This makes the window "click through" aware and transparent.
Make it fullscreen (so you can draw to wherever you want). The "topmost"-part to be on top of everything is of course to be done too (dunno if it is available in maxgui).


If you need DX/OGL support:
http://www.gamedev.net/topic/445141-c-directdraw-overlay-library/
http://www.gamedev.net/topic/359794-c-direct3d-hooking-sample/
http://directdrawoverlaylib.codeplex.com/releases/view/3687
...


As soon as you cannot guarantee that only "simple apps" are run you will surely have to bite the bullet.


bye
Ron


Kryzon(Posted 2015) [#9]
You haven't specified the operating system, there are different solutions depending on that.

Also, read this:
http://blogs.msdn.com/b/oldnewthing/archive/2011/03/10/10138969.aspx


Naughty Alien(Posted 2015) [#10]
..thanks guys..application should be windows only..


Kryzon(Posted 2015) [#11]
I understand.
That article and some of the comments there discuss that, if the system is completely unknown, there is no way that you can guarantee to your client that you can make your application window persistently on top of everything else all of the time.
The OS functionality that you'd be using to make your application the topmost one would also be available to any other application that also wanted to do the same, and there could be conflicts \ competition.

All that being said, if your application is the only one trying to make a topmost window in that airport environment, it could work.
I'd take a look at the following Win32 functionality, with what Derron said above:

- http://msdn.microsoft.com/en-us/library/ms633556(VS.85).aspx
- http://www.codeproject.com/Articles/34158/Cool-Semi-transparent-and-Shaped-Dialogs-with-Stan
- http://stackoverflow.com/a/834509/4206247


Naughty Alien(Posted 2015) [#12]
..thanks Kryzon..i thought it should be not so big task as i have seen plenty of time exactly that effect, with game trainers..every time you run that thing, no matter what application is running or you start it later, game trainer graphics is on the top (until you start particular game), so i thought it could be done relatively straightforward with bmax..but it seems i was wrong..


Derron(Posted 2015) [#13]
Another thing you need to consider:

David@stackoverflow: From MSDN: "If this function is called from a 32-bit application running on WOW64, it can only enumerate the modules of a 32-bit process. If the process is a 64-bit process, this function fails and the last error code is ERROR_PARTIAL_COPY (299)."

http://stackoverflow.com/questions/11810854/opengl-directx-hook-similar-to-fraps

Seems when enumerating GDI windows (open applications) you will need to have a 64bit app if you want to get other 64bit apps too ...in that case you surely will need -ng or another language than BlitzMax.


Above SO-link links to:
http://easyhook.codeplex.com
and
http://www.ring3circus.com/gameprogramming/case-study-fraps/
with the ladder being not available so visit it [a https://web.archive.org/web/20120628161712/http://www.ring3circus.com/gameprogramming/case-study-fraps/]using the wayback machine[/a].


Seems the principle of "fraps" is to enumerate running processes, try to hook into their DLLs and call additionally itself as soon as specific calls are done (like "flip").


All of above is not needed if you can ensure:
- no other window on top (dunno how to handle this "fight")
- no DX/GL app is running at the screen portion of your overlay


bye
Ron


Brucey(Posted 2015) [#14]
You might get away with a simple program, just to display a transparent window in the corner with logo (or wherever), and have it poll from time to time, and lift itself back to the top of the window stack.

You can initially make it topmost and set to always on top - which would be true until presumably another window appears and wants to also be always on top. If this is a static display (i.e not a normal interactive PC) then there's less chance of foreign apps trying to get in your way.

The other option is to get some stickers and stick your logo on the screens :-)


Derron(Posted 2015) [#15]
@ sticker ... nifty idea

Another Idea is to run everything in a full-screen-virtualbox - except your app. So at the end you only have to cover ONE "app" :p

Similar principle is a remote-vnc-connection.


But Brucey is right: start up with the "always on top + click-through + transparent" window and it will surely do well already.

Maybe you should mention if you are running other of your blitzmax-apps (non-maxgui) there which would mean DX or OGL.


bye
Ron


Naughty Alien(Posted 2015) [#16]
..LOL Brucey..well..its basically alert system which should overlay airline logo + some passenger information, on to all PC's , once alert is issued..

..anyway, I found small application which does exactly what im asking (in terms of keeping graphics over anything running on pc)...unfortunatelly no source so i cant see how it is done...i cant remember name of it, but ill post tomorrow as its on my office pc..


Derron(Posted 2015) [#17]
Maybe you didnt see it in the above post:

http://taksi.sourceforge.net/

this is some kind of "open source fraps" - so it gives insight how to handle it.


bye
Ron


Scaremonger(Posted 2015) [#18]
Try this:




This does a complete overlay, keeps the window on top and does not show in the application bar (WINDOWS_TOOL). If you want an icon in the appbar, change style as required.

The example uses BLACK as transparent but you can use anything.

Enjoy...


Naughty Alien(Posted 2015) [#19]
@ Scaremonger
..thank you very much..i owe you one..

..program i was reffering in my previous post yesterday is 'Floaty' and very simple..basically what scaremonger posted now will do same job..

https://dl.dropbox.com/u/6444067/floaty/floaty-0.1.zip