[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

How to manually edit/manage active desktop items

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?
Thanks
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!
0
aleemjuma
Asked:
aleemjuma
  • 4
  • 2
1 Solution
 
TJworldCommented:
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]
"Source"="http://news.bbc.co.uk/"
"SubscribedURL"="http://news.bbc.co.uk/"
"FriendlyName"="BBC NEWS | News Front Page"
"Flags"=dword:00002002
"Position"=hex:2c,00,00,00,68,02,00,00,dd,00,00,00,a8,00,00,00,9e,00,00,00,ea,\
  03,00,00,01,00,00,00,01,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00
"CurrentState"=dword:40000001
"OriginalStateInfo"=hex:18,00,00,00,68,02,00,00,dd,00,00,00,a8,00,00,00,9e,00,\
  00,00,01,00,00,00
"RestoredStateInfo"=hex:58,93,ef,02,06,02,0d,00,48,a5,ef,02,e4,bc,e3,77,80,23,\
  e1,77,9c,93,ef,02

----------------------------
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", "http://news.bbc.co.uk/");
.... 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
0
 
aleemjumaAuthor Commented:
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?

Aleem
0
 
aleemjumaAuthor Commented:
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...
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
TJworldCommented:
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.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/stdregprov.asp

The error you get is, I think, this:

WBEM_E_NOT_FOUND
    0x80041002
    Object could not be found.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_error_constants.asp
0
 
aleemjumaAuthor Commented:
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...)

ta

Aleem
0
 
aleemjumaAuthor Commented:
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.

Thanks.

Aleem
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now