Home All Groups Group Topic Archive Search About
Author
1 Feb 2006 10:29 AM
Georgi nikolovski
Hello,

I found on planet-source  a code how to change wallpaper using ActiveDesktop
object. It uses reference to "active desktop vb compatible type library" and
works fine.
Now I want to add picture to ActiveDesktop witch I will change it daily.
Probably I should use  'AddDesktopItem' and COMP_TYPE_PICTURE but I am not
really sure how to do it. Does anybody know the correct way to do it, or
where can I find some exemples on this subject. I tried MSDN but there are
no examples, just descitption of IActiveDesktop.

Thanks.

Author
2 Feb 2006 12:49 AM
MikeD
"Georgi nikolovski" <gn***@mt.net.mk> wrote in message
news:43e08d9f@news.mt.net.mk...
> Hello,
>
> I found on planet-source  a code how to change wallpaper using
> ActiveDesktop object. It uses reference to "active desktop vb compatible
> type library" and works fine.
> Now I want to add picture to ActiveDesktop witch I will change it daily.
> Probably I should use  'AddDesktopItem' and COMP_TYPE_PICTURE but I am not
> really sure how to do it. Does anybody know the correct way to do it, or
> where can I find some exemples on this subject. I tried MSDN but there are
> no examples, just descitption of IActiveDesktop.


Ar you talking about just changing the wallpaper?  You don't want to add a
DesktopItem to do that. Call the SetWallpaper method and then call the
ApplyChanges method of the IActiveDesktop interface. Here's an example:

Private Function SetWallpaperAD(oAD As ActiveDesktop) As Boolean

    Dim lRet        As Long
    Dim pco         As COMPONENTSOPT

    lRet = oAD.SetWallpaper(m_sFileName)

    If lRet = S_OK Then
        lRet = oAD.ApplyChanges(AD_APPLY_SAVE)
        If lRet = S_OK Then
            SetWallpaperAD = True
            Select Case LCase$(GetExtension(m_sFileName))
                Case "gif", "jpg", "htm", "html"
                    'ActiveDesktop must be enabled for these file types
                    pco.dwSize = Len(pco)
                    oAD.GetDesktopItemOptions pco
                    pco.fActiveDesktop = 1
                    'pco.fEnableComponents = 1
                    oAD.SetDesktopItemOptions pco
            End Select
            oAD.ApplyChanges AD_APPLY_ALL Or AD_APPLY_FORCE
        Else
            SetWallpaperAD = False
        End If
    Else
        SetWallpaperAD = False
    End If


End Function

If this is not what you're talking about, then I don't know what you mean by
"add picture".

--
Mike
Microsoft MVP Visual Basic