• Advertisement

Archived

This topic is now archived and is closed to further replies.

Graphics on desktop

This topic is 5748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys. How would one go about creating a program that draws to the background image of the windows desktop? There''s a program out there that does this, it''s called Drempels. Does he have to write to a bitmap and then update the windows background bitmap? Seems to me that would be awefully slow, much slower than the program runs. Is it possible to grab a pointer or something to the desktop memory? I''m just wondering because it''s an awesome program and I''d like to put something like a starfield on my desktop.

Share this post


Link to post
Share on other sites
Advertisement
I am too lazy to download the thing so i don''t know exactly what it does. Many programs exist that will write all over the desktop. If i remember correctly GetDesktopWindow () will give you the HWND of the desktop. With this you can use GDI to draw all over it, or subclass the window and change its behavior.

Share this post


Link to post
Share on other sites
invective, that way messes up the desktop and requires the client application to restore it to its original state.

The proper way to do this (it''s in one of the MSDN samples - I remember it from v4.0) is to create a borderless window with a NULL background brush. Then use regions on any objects you draw to restrict painting so the image seems to appear right on the desktop. Dig around on your CD if you have the MSDN Library, or online if you don''t. It''s a sprite animation sample.

Share this post


Link to post
Share on other sites
I think I know what you're saying. But I'm not interested in writing OVER the desktop, instead drawing on the background of the desktop. Is that what your solution would do? Dremples creates this effect:



With a swirling plasma-type graphic under all the icons. I don't plan to do a swirling plasma thing, but I thought it would be cool to do a starfield.

The GetDesktopWindow API says it returns the window which "is the area on top of which all icons and other windows are painted." Would that be the background? If so, then maybe that's what I need.

[edited by - Ronin Magus on May 31, 2002 12:54:47 PM]

Share this post


Link to post
Share on other sites
I recommend everyone download Drempels. It's quite an amazing program. It turns your whole desktop wallpaper into a swirling lava lamp-type display as long as you have a 450mHz computer or so.

[edited by - Narcus on May 31, 2002 2:40:43 PM]

Share this post


Link to post
Share on other sites
One simple way: Try it and see! To me it seems like the GetDesktopWindow() is what you need.

Share this post


Link to post
Share on other sites
Well since no one tried it yet, I implemented it, and it seems that GetDesktopWindow with GetDC just does the same as GetDC (NULL), ie lets you paint over the WHOLE screen (not just the wall paper), which is not what he wanted... so anyone have another idea?

Share this post


Link to post
Share on other sites
I tried a small program with GetDesktopWindow, and I don''t believe it''s the answer. But, Spy++ tells me that the actual desktop window where the icons are is of class "SysListView32," so I''m going to see what I can do with that.

One question though... I think I''ve seen an API that returns a hwnd to the window that is at a specific x,y point, but its name escapes me!! Any help?

Share this post


Link to post
Share on other sites
This is written in Delphi, but it sort of explains the process for getting the Listview window... I'll have to study on what to do next, and if it's even possible with that window.

here

[edited by - Ronin Magus on May 31, 2002 3:55:20 PM]

Share this post


Link to post
Share on other sites
Alright, here's an idea I just had. Maybe this effect could be created by following these steps:

When starting up the program:
1. Set desktop background wallpaper to nothing (remember what it was though)
2. Set desktop background color to a specific color
3. Blt the image of the desktop into memory

While running your background effect:
4. For each frame of your program, mask the memory image of the desktop over what you want displayed, using the color used before as transparent
5. Blt the frame onto a window the size of the desktop

When the program exits:
6. Reset the background color to initial color
7. Use SystemParametersInfo to reset the wallpaper
8. Destroy the window you were blting to.

That would possibly work, No?

Most of the desktop color changing/wallpaper changing could be done with SystemParametersInfo()

[edited by - Ronin Magus on May 31, 2002 5:28:57 PM]

Share this post


Link to post
Share on other sites
quote:
One question though... I think I''ve seen an API that returns a hwnd to the window that is at a specific x,y point, but its name escapes me!! Any help?


WindowFromPoint() perhaps? (I used this for my screenmate. It''s Spiffy(TM).

-fel

Share this post


Link to post
Share on other sites
Ronin, that's a good idea, but you would not be able to use the icons while it's running. hmmm...

[edited by - Zumichu on May 31, 2002 5:46:48 PM]

Share this post


Link to post
Share on other sites
I''m short on time right now so I can''t check these out, but there''s a function called OpenDesktop(). Similarly you can check out PaintDesktop(), which:

"The PaintDesktop function fills the clipping region in the specified device context with the desktop pattern or wallpaper. The function is provided primarily for shell desktops."

BOOL WINAPI PaintDesktop(HDC hdc);

Note that I''ve never used either of these, so I don''t excactly know what they do - just maybe they''re worth checking out. Anyway this is what I came up with as a reuslt of a 5 min search in my BC help files.


Hope this helps,
Crispy

Share this post


Link to post
Share on other sites

  • Advertisement