Board index » cppbuilder » Changing Desktop background

Changing Desktop background


2005-04-19 01:49:50 AM
cppbuilder53
I'm trying to write an application to control the Windows XP desktop!
Specifically speaking, on how to change the background picture on a daily
basis.
Basically, I have 2 problems:
1) I have a book "Win32 Programming API Bible" that instructs me on how
to get a thread for the Desktop, but I get the compiler error "function is
not a member of Application" for GetCurrentThreadID().
I'm using something like this
HDESK hDesktop = GetThreadDesktop( GetCurrentThreadID() )
This will get me the desktop handle:
2.) Once I got the desktop handle, how do I find out which thread controls
the background image, or Active Desktop function as XP calls it.
Thanks,
Freedom comes when you learn to let go, Creativity comes from when you learn
to say No! ~ Madonna
 
 

Re:Changing Desktop background

"Bsisko" < XXXX@XXXXX.COM >wrote in message
Quote
I'm trying to write an application to control the Windows XP desktop!
Specifically speaking, on how to change the background picture on a daily
basis.
Change in what way exactly? If you are working with bitmaps only, then you
can use SystemParametersInfo() with the SPI_SETDESKWALLPAPER flag. If you
are working with other image formats, or anything else fancy, then make sure
Active Desktop is enabled and then you can use the IActiveDestop interface.
Quote
1) I have a book "Win32 Programming API Bible" that instructs
me on how to get a thread for the Desktop
Why do you need a thread for the Desktop?
Quote
but I get the compiler error "function is not a member of Application" for
GetCurrentThreadID().
You misspelled the function name. The name is "GetCurrentThreadId", not
"GetCurrentThreadID".
Quote
HDESK hDesktop = GetThreadDesktop( GetCurrentThreadID() )
This will get me the desktop handle:
You are thinking of the wrong desktop in that code.
Quote
2.) Once I got the desktop handle, how do I find out which thread
controls the background image, or Active Desktop function as XP calls it.
You don't need to know that to begin with. You are taking the completely
wrong approach in accessing the Desktop background image. Please refer to
my comments further above.
Gambit
 

Re:Changing Desktop background

Bsisko wrote:
Quote
I'm trying to write an application to control the Windows XP desktop!
Specifically speaking, on how to change the background picture on a daily
basis.
What Remy said....
Specifically, look at the topic "Desktop Window" in the Win32.hlp
 

{smallsort}