Solved

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

Posted on 2001-09-05
13
499 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
ID: 6457090
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
ID: 6457121
Better yet, use the features of the active desktop & write it in html instead.

GL
Mike
0
 
LVL 3

Expert Comment

by:Slavak
ID: 6457148
listening
0
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
LVL 3

Expert Comment

by:MarcG
ID: 6457200
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
ID: 6457272
Madshi,

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

rondi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6457530
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
 
LVL 10

Expert Comment

by:Jacco
ID: 6457892
listening
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6459500
listening
0
 

Author Comment

by:triton090898
ID: 6459941
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
ID: 6459952
**** ;)

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

;) triton
0
 
LVL 20

Accepted Solution

by:
Madshi earned 200 total points
ID: 6460057
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
ID: 6463366
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
ID: 6463724
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

778 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