Solved

How to place a form or canvas behind the win icons?

Posted on 2001-09-05
13
491 Views
Last Modified: 2010-08-05
Hi,

I'm quite desperatly seeking a way to draw on the desktop while the win icons (and other apps) remain the same.

If you'd like to see an example please take a look at: http://www.geisswerks.com/drempels/ (desktop mode) which is an excellent tiny tool, btw. So as you see I'm not talking about a static wallpaper, rather a dynamic one ;)

I have tried to use sendtoback(); with my app but that simply puts the Tform behind all others. The windows icons are still further behind, the desktop even more.

I'd like to have my form behind the icons and in front of the desktop :)

Any ideas?

Thanks, triton
0
Comment
Question by:triton090898
13 Comments
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
I think you have to subclass the desktop listview control by calling SetWindowLong(desktopListViewHandle, GWL_WNDPROC). Unfortunately this works only if you're inside of the explorer process. To achieve that, you need to put your stuff into a little dll and make sure that the dll is loaded into the explorer. You can misuse SetWindowsHookEx by creating a dummy message hook to do that.

Regards, Madshi.
0
 
LVL 6

Expert Comment

by:edey
Comment Utility
Better yet, use the features of the active desktop & write it in html instead.

GL
Mike
0
 
LVL 3

Expert Comment

by:Slavak
Comment Utility
listening
0
 
LVL 3

Expert Comment

by:MarcG
Comment Utility
maybe you don't need to draw _behind_ the desktop ... you could do something like fake that you are drawing behind the desktop icons with making a screenshot of the current desktop and set all exept the icons to transparent, this transparent picture of the desktop you paint above the canvas you are painting on and it will look like if you are painting behind the icons.
to get a transparent image of the desktop you could replace the wallpaper with just a single color (one that is not very often used in icons would be best) than take the screenshot and set the background color to transparent. Before doing that remember what the wallpaper was before so you can restore it.
Now all should be ready for your drawing ...


this is just a brain experiment, I never did something like this, I was just thinking of a way how this could be achieved.
0
 
LVL 3

Expert Comment

by:rondi
Comment Utility
Madshi,

Please elaborate on the use of SetWindowsHookEx to trick
Explorer into loading me into memory

rondi.
0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
If you can use Mike's solution (ActiveDesktop), it's surely the better way, because it's clean and documented.

About SetWindowsHookEx:
(1) Get the desktop list view handle ("wnd := FindWindowEx(FindWindowEx(windows.FindWindow('Progman', 'Program Manager'), 0, 'SHELLDLL_DefView',''), 0, 'SysListView32', '');").
(2) Call GetWindowThreadProcessID to get the threadID to which the desktop list view belongs.
(3) Call SetWindowsHookEx(WH_GETMESSAGE, @DummyHookProc, YourDllHandle, ThreadIDFromStep2) to install a dummy message hook. The "DummyHookProc" callback function must be located in a little dll.
(4) Now call PostMessage(desktopListViewHandle, WM_NULL, 0, 0). As a result Windows will load your dll into the context of the thread which owns the desktop list view and calls your message callback function there.
(5) Now in the dll you can subclass the desktop list view.

Regards, Madshi.

P.S: There's also an easier method of injecting a dll into a different process without needing this nasty SetWindowsHookEx hack. It's documented here (see the very bottom of the page):

http://help.madshi.net/Data/DllInjecting.htm#InjectLibrary

The packages described there are free for non-commercial usage.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 10

Expert Comment

by:Jacco
Comment Utility
listening
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
listening
0
 

Author Comment

by:triton090898
Comment Utility
Uhmmm,

thanks folks. But I think we've got a prob here ;)
Houston? :)))

I won't be able to hook my code onto another process. And I won't be able to snapshot the icons to pretend they're still there.

Just take a look at the page http://www.geisswerks.com/drempels/ and you'll see.
If you install that 500kb boy ;) simply tell it to use 'desktop mode'. It'll blow you away. W9x & W2k.

With that tiny tool you have a full screensaver running on your pc all the time, but you can still use the entire icon, window and startmenu functionality, because they're still visible. Once again: everything is still usable.

So there must be a way to render/draw on the desktop object. ActiveX has nothing to do with it, it actually has to be deactivated for this.

Any more ideas?

triton ;)
0
 

Author Comment

by:triton090898
Comment Utility
**** ;)

Of course ActiveDesktop has to be deactivated, not ActiveX :)))

;) triton
0
 
LVL 20

Accepted Solution

by:
Madshi earned 200 total points
Comment Utility
Hello, here is Houston.

Drempels uses an alternative method: It changes the background image of the desktop to none and the background color to pink, which is the default video overlay color. Then it uses video overlay functionality to draw. The effect is that Drempels not only draws on the desktop background, but only on every other pixel on the screen, which is pink. If you open a jpeg foto in Photoshop, and there are pink pixels in it, these pixels will also be overdrawn by Drempels. Furthermore not every graphics card (but almost every) supports video overlay. I don't know how to do video overlay programming, if you want to go this way, I'm out of this question...

Regards, Madshi.
0
 

Author Comment

by:triton090898
Comment Utility
Hi Madshi,

that was what I wanted to hear. I have two friends, one doing www.openuniverse.org, another doing www.shatters.net/celestia (you'll love it).

I hope you don't mind if we contact you in case we have a few further questions you can answer?

Thanks in Advance, triton ;)
0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
Thanx for the points...

If the further questions belong to this thread, please ask them directly here, so the others can participate. Otherwise please post a new question in Experts-Exchange. I'm always looking for new questions in EE. You can post a link to your new question(s) here, just to be sure that I don't miss the new questions(s).

Regards, Madshi.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now