Hi Guys

How to force a app to be showend in the background of the desktop ?

I mean, on such a way that i can see the main window of the app (His contents etc), but, the icons on the desktop (and all other apps) be on the foreground ?

Iīm trying to force a app to work beind the desktop..The idea is similar to background images on the desktop, where we can move the mouse on the desktop over it, where the icons can be over it...but still we can see the main image...but we canīt change/move it. Iīm trying to get the same effect with an app.

The app shows a spining molecula,?  but i want that itīs main window works behind the desktop area.


Best Regards,

Guga
Posted on 2006-05-21 05:24:59 by Beyond2000!
Hmm, good question.

One way that ought to work is to set the desktop background color to some "special" value. Then use a color-keyed blit (probably requires DirectDraw?). I got a movie player to work that way :)
Posted on 2006-05-21 06:06:16 by f0dder
Hi F0dder

Seting a color of the window ? Like making something similar to shape/skinned windows ?

I donīt know..i was thinking in something different. Not exactly concerned with matching the background colors...But, putting the app really behind the desktop. I mean when you move a certain app or icon over the desktop the desktop oicons are "hidden" by them becauyse the app is in front of it.

My idea was the opposite..making the app be behind the desktop.

What movie player of yours does it ? Can u send me a link to see it working ?

I was thinking in finding the thread of the desktop, and trying to work directly with the threads, insetad the colors.

Best Regards,

Guga
Posted on 2006-05-21 11:38:27 by Beyond2000!

My idea was the opposite..making the app be behind the desktop.

I don't really know if this is doable though, and probably not in a way that supports all windows versions and other shells (like blackbox, litestep, geoshell, ...)

Let me try to explain the video player example a little further. It's based on something called overlay surfaces. Try taking a screenshot of a media player - if you have hardware acceleration, the screenshot file will not contain the image from the video, it will be a rectangle of some special color (often pink).

This special color is the "color key", and (rough description) defines the region where the overlay will be blitted. Any pixel that doesn't have this color will not be touched.

So, the idea would be setting the desktop background color to this "magic color", and use a color-key blit against the entire screen. Only the background will be touched (because it's the "magic color"), and it will give the impression that you're rendering to the desktop.
Posted on 2006-05-21 11:45:59 by f0dder
Hmm..interesting.

Do you have any example of that ? I have no idea what is overlay surfaces, nor how to code something like this.


I juts found something (I guess) but it is for an OS called Symbian. I didnīt understood one single word of that..but..if you would like to take a lookto see if this can be something usefull..here it is:

http://www.newlc.com/Moving-an-application-to.html

Or..,maybe this ?

http://www.everythingaccess.com/tutorials.asp?ID=Bring-an-external-application-window-to-the-foreground

But the above we set tjhe app to the thread before the threadID of the desktop ?


Best Regards,

Guga
Posted on 2006-05-21 11:59:12 by Beyond2000!
You can try this... It is not exactly what you are after, but maybe it helps :)

Just start Notepad and make it small window (not fullscreen) and then run Ghost Notepad.exe from the attachment. Your notepad should change to semi transparent and it should ignore keyboard and mouse input. All input is going thru Notepad's window to the window below it in Z order. Unfortunately, this does not make your app, or in this case Notepad to work below Desktop, but when it is semi transparent you can see desktop icons thru it. I tested this on XP SP2, it may work also on Windows 2000.

This is a quick hack and thus you need to use Taskmanager to kill Notepad.exe after it is ghosted or change my prog to preserve old settings and make it restore them  :D

Best regards,
Sami
Attachments:
Posted on 2006-05-22 14:21:07 by SamiP
Tks SamiP

But, this is not helping too much. I donīt want a transparent app..

I looked for someway to do this on the function SetDeskWallpaper from user32. But it also donīt helps too much. I was trying to figure it out how windows manages to set desktop wallpapers. Maybe this could helped, but...i back to the gorund zero :sad:


I heard that OpenGL doesn't know what a window is. Instead, it renders into a context, which is simply a chunk of the screen.

So i was thinking in how to setup a DeskTop context  to the OpenGL Api be renderred onto(whatever that is ;) - Context = handle ?) creating on it a pixel format, creating a context, attaching the context to the desktop.

Iīm continuing searching it.

Best Regards,

Guga
Posted on 2006-05-23 16:22:20 by Beyond2000!
Attach your window somehow, as shown in the image. Use CS_PARENTDC.
The ListView32 here is what shows your icons on the desktop.

Haven't tried it, though, and haven't seen anyone do it except for microsoft ^^"
So, pls try and share results :)
Attachments:
Posted on 2006-05-23 18:52:53 by Ultrano
I kinda succeeded, though it requires ActiveDesktop to be enabled, and dragging things over the window is ugly
Attachments:
Posted on 2006-05-23 21:01:36 by Ultrano
Hi Ultrano

Many TKS..It is working :)

The problem of the icons being ugly maybe because we need to set a mask of the desktop color and the window color.

I suceeded to make it work on my app using your code. Take a Look at the screenshot on my DeskTop, below.

Iīm reviewing the code a little and will post here in a couple of moments.

There are minor problems with draging the icons that are over the "behinded" app, and also...Is it necessary to always use the active desktop ? I mean, here on Win2000 it automatically activates it..But i have no idea, on other OSes.


Iīll post the full code on a moments.

Best Regards,

Guga

Attachments:
Posted on 2006-05-24 00:52:00 by Beyond2000!
By "and dragging things over the window is ugly" I actually meant the problem you noticed, too - "There are minor problems with draging the icons that are over the 'behinded' app"  :) ... it was just 5:00am for me here ^^"

I tried to solve the dragging problem, but my window wasn't getting any WM_ messages ... Prolly it's because of the listview's drag-drop file commands.

Posted on 2006-05-24 03:49:12 by Ultrano
Ultrano,
Have you tired to subclass into the desktop's listview?
and look for the messages you need?

Zcoder....
Posted on 2006-05-24 04:17:55 by Zcoder
nope :)  The listview is already subclassed once, btw :)
Posted on 2006-05-24 06:01:15 by Ultrano
Hi Guys

Here goes the file. Iīm uploading the Source, and also the Executable file (With the source inside). Syntax is for RosAsm, but it is easy to follow.

I faced some problems.

I inserted a fadeIn/fadeOut effect (Tks for the idea ZCoder :) ), but insetad using the SetLayeredWindowAttributes Api, i used the AnimateWindow Api to make it posible to the effect shows also on Win98.

But... the problem with FadeIN is that once teh effect is applyed i canīt see the molecule running, except if i minimize or maximize the window. (So to test, donīt?  check the full screen mode or the background mode)

The animatedwindow Api with OpenGL apps is described here:

http://www.stephan-brumme.com/download/game%20programming/Games1.pdf

But, i couldnīt understand what iīm doing wrong.

Also.. on this version i removed the FadeOut effect, because it was not working....When the WM_DESTROY message was being set the blade effect was not showing.

A couple of questions:

1) What iīm doing wrong ?
2) How to make FadeIn and fadeOut work properly ?
3) The App is eating 8 to 20% of memory (From a total of 256) and i think that it is too much. I saw some other apps consuming a minor and more stabel rate (Around 1% or 2%). Iīm quite sure i forgot to release some memory in one of the OpenGl apis...What iīm doing wrong ?
4) I made a small routine to check for the rpesence of the ActiveDeskTop. But...once it is detected, how to enable it automatically ?


Todo: Add a trayiconmenu to allow the app exits when it is on BackGround Mode.

Best Regards,

Guga
Posted on 2006-05-24 18:30:09 by Beyond2000!
Hmm judging from the performance (0.5fps), this approach of using activedesktop is not good for anything animated :( . Instead, let's do it with overlays! :)

So, the image route will be OpenGL->DDraw, GDI might have to serve as a medium. Just like in BSPlayer, you could have a view-window, and a control-panel (control-window). The view-window being able to be behind desktop, in a small window, or in fullscreen.
Posted on 2006-05-24 19:40:30 by Ultrano
0.5 ?????

Hmm...I suppose you used the 1024*800 mode in the background mode, right ?

If so..this is similar to what i have here.

If i use 640*480 and BackGround Mode only checked. The Frame Rate is higher.

What is the variance of Frame rate you got on your machine ?

So, the image route will be OpenGL->DDraw, GDI might have to serve as a medium. Just like in BSPlayer, you could have a view-window, and a control-panel (control-window). The view-window being able to be behind desktop, in a small window, or in fullscreen.


Sorry, i didnīt understood this. What is BSPlayer ?

M<aybe the better is allowing the background mode only uses 640*480. This should fix the farme rate problem in older machines. (And mine is an old one too :) )

Best Regards,

Guga
Posted on 2006-05-24 19:48:09 by Beyond2000!
1024x768 32bpp, ran the app with only one box ticked: "BackGround mode".
Sempron 2200+, FSB400, 512MB DDR400, Radeon9200 at AGP8, fastwrites on.
0.5fps up to 2.0 fps. ( the app renders a 640x480 rectangle, centered to screen, behind the SysListView32). Yet, I am not very sure how well my drivers are now. I'm playing Sin:Emergence (released two weeks ago), and CSS with no probs - so I guess the drivers are ok, Direct3D-wise.



BSPlayer is ... www.bsplayer.org :)  (try pressing "D" while watching a video)
Posted on 2006-05-24 20:01:00 by Ultrano
So, the image route will be OpenGL->DDraw

Wouldn't it be wiser to use Direct3D9? Direct3d, DirectShow and DirectDraw are all 1, single entity in Directx9. You can render something 3d and blit it to a portion of the screen 'attached' to the desktop's background. This way it'll be drawn after the wallpaper, but before the icons. You can also render it directly to the screen with alpha transparency.
Posted on 2006-05-24 20:38:52 by ti_mo_n
Hi ti_mo_n

Maybe not... Not everybody have DX9. Some people still have a 56 Kbps modem, or just donīt have DX9 installed.

But....everybody that uses windows, have Opengl libraries

Dx9 maybe easier, but also it wouldnīt be totally extensible to everyone.

Also, i just tested a example using DX9 (Argh..i have to download DX9 again from here. 50 Mb or something, :) ), and the sped of the animation does not varies that much. The problem with the speed is inside my Code. Iīm pretty sure i didnīt release memory fro some OpenGL api (Something called genlist or something)...Since iīm not used wiuth OpenGL programming, iīm unable to fix it alone.

Best Regards,

Guga
Posted on 2006-05-24 22:50:55 by Beyond2000!