How to manually edit/manage active desktop items

Posted on 2004-11-24
Last Modified: 2013-12-03
I would like to manage my Active Desktop items manually and primitively (e.g. using notepad or some other ). Can anyone tell me, please, how I can add an item to the Active Desktop **WITHOUT** using regedit, or Control Panel (including Desktop Properties/Active Desktop via right-clicking the desktop), or clicking 'Set as Desktop Item' in IE?
This is pretty much a challenge question. Points will NOT be given for anyone saying that it cannot be done!!

OS: Windows 2k Terminal
Active Desktop is enabled and one desktop item (a single JPG image) already exists and is visible/movable.
Desired: additional desktop item consisting of an HTML file that I have ready (call it C:\file.html)

I wanted to assign 750 points to this but they wouldn't let me so I don't mind adding points if the answer is contorted (read 'clever') enough!
Question by:aleemjuma
    LVL 5

    Accepted Solution

    You have to access the registry to set this, because the setting is at

    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\

    The only way to manipulate this using notepad would be to create a registry file and merge it into the registry by right-clicking it and choosing Merge. You'd still need to have read the registry to know which .\Components\ sub-key to create - 1, 2, 3, 4, and so on.

    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\1]
    "FriendlyName"="BBC NEWS | News Front Page"

    Shell Script with Windows Scripting Host that writes to the registry.

    In Javascript you'd do something like this:

    var wshShell = WScript.CreateObject("WScript.Shell");
    var regKey = "HKCU\Software\Microsoft\Internet Explorer\Desktop\Components\1\";
    wshShell.RegWrite("Source", "");
    .... etc

    but you can't write more than one double-word to a REG_BINARY value so you'd not be able to write "Position", "OriginalStateInfo" or "RestoredStateInfo".

    Why would you want to do this anyhow? Are you trying to hijack someone's PC? ;-p
    LVL 1

    Author Comment

    VBScript! Why didn't I think of that!!

    Wait.  Don't answer that...   :)

    No I'm not trying to hijack someone's PC - I'm just trying to reinstate a desktop item that I had, but I don't have access to regedit.exe.

    OK. So I need StdRegProv to read/write REG_BINARY values to the registry - that's the GetBinaryValue and SetBinaryValue methods - correct?

    so this should echo 0 and leave aValue(x) initialised with the xth hex value...

    Dim Key, SubKey, Value, aValue(24)
    Key = &H80000001 'HKCU
    SubKey = "HKCU\Software\Microsoft\Internet Explorer\Desktop\Components\1\"
    Value = "RestoredStateInfo"
    WScript.Echo oReg.GetBinaryValue(Key,SubKey,Value,aValue)

    so why does this echo 2 and leave aValue(x) set to Null?
    i tried looking up what error code 2 means but couldn't find it - is there some translation necessary between the '2' and a normal 0x800... error code?

    LVL 1

    Author Comment

    normal vbscript access to the registry worked, by the way, so i can nicely set the rest of the stuff, just the binary values for which i need stdregprov...
    LVL 5

    Expert Comment

    The problem with the code example you've quoted is you could blindly over-write the \1\ subkey.

    The result might be null because key \1\ doesn't exist.

     If you want it well-behaved you have to enumerate the existing sub-keys first and then use the next available index number.

    The error you get is, I think, this:

        Object could not be found.
    LVL 1

    Author Comment

    it wasn't cos the \1\ key doesn't exist - i still had "HKCU" in the key string! [doh!]

    managed to get another desktop item activated but it's appearing as a transparent box with a cross in the top corner (indicating it can't find the file i guess) but when i click the triangle menu at the top and select 'open in new window' the right file displays in iexplore fine. can anyone shed any light on this?

    could it be to do with the flags or state values?

    let me know if you need current values of flags and states and i'll post them up on mon/tues (am at a different computer at the mo...)


    LVL 1

    Author Comment

    I haven't had time to work on this enough lately so I think I'll just close the question but first here's where I'm at:

    I have managed to get the items on the screen, but only partially. The correct file is being refereced for the item content but the content is not being displayed.

    I'm sure it can be done with VBScript, as TJworld suggested (so points to TJworld), but I can't seem to make it work fully. If anyone can I'd appreciate a comment on this thread and/or a reference to the solution.



    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now