I have always thought that replacing the normal windows desktop icons with an "active desktop" html page which can launch my programs, as well as open directories and files through links. This would be a r开发者_StackOverflow社区eally cool way to customize one's desktop.
Using the "file://" protocal was my first approach but this does not work correctly. In another SO Post I found this link but its a little over my head. Is this the correct approach?
I can't imagine that I am the first one to consider this; it seems like a good idea (no?). What do you all think?
I like the idea of active desktop for a desktop customization. What you can do is register your own schema
Add a Registry entry. Here is the first example I worked with.
Add This to a .reg file and Import into the registry.
Change "myschema" and the location of the executable to match your own needs
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\myschema]
@="URL:My Schema Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\myschema\DefaultIcon]
@="C:\\Program Files\\MySchemaProgram\\MySchema.exe,1"
[HKEY_CLASSES_ROOT\myschema\shell]
[HKEY_CLASSES_ROOT\myschema\shell\open]
[HKEY_CLASSES_ROOT\myschema\shell\open\command]
@="\"C:\\Program Files\\MySchemaProgram\\MySchema.exe\" \"%1\""
Now if you create a hyperlink
<a href="myschema://Whatever+i+want" >Click Here</a>
Your computer will open your MySchema Application with the href in the command line.
just be mindful because Ervironment.CommandLine will be UTF Decoded therefore
//This Link
<a href="myschema://Something%20Here">Click Here</a>
//Will Result in This Command Line Execution.
"C:\Program Files\MySchemaProgram\MySchema.exe" myschema://Something Here
You can also use this schema in the ShellExecute commands as well as the Run Dialog.
Here is the example program I used to get started with. You should be able to get the idea pretty quick
using System;
using System.Collections.Generic;
using System.Text;
namespace Alert
{
class Program
{
static string ProcessInput(string s)
{
// TODO Verify and validate the input
// string as appropriate for your application.
return s;
}
static void Main(string[] args)
{
Console.WriteLine("Alert.exe invoked with the following parameters.\r\n");
Console.WriteLine("Raw command-line: \n\t" + Environment.CommandLine);
Console.WriteLine("\n\nArguments:\n");
foreach (string s in args)
{
Console.WriteLine("\t" + ProcessInput(s));
}
Console.WriteLine("\nPress any key to continue...");
Console.ReadKey();
}
}
}
best of luck with your application. I would be eager to see it when it is complete.
EDIT: I am adding some matching strings for this as it is a cool feature and more people may want to use this technique for something they wanted to do.. These are the things i looked for it under, (unsuccessfully) Let me know if anyone thinks of any more.
custom url/uri handler
custom schema program
registry web address program
handle web link
launch app from url
I've looked into what you've asked a while back and never found anything that worked well.
Ultimately if the goal is full customization of your desktop, I think you can get a similar result by researching something like this: http://rainmeter.net/RainCMS/ and http://kaelri.deviantart.com/art/Enigma-103823591 Lifehacker has tons of links/tutorials on how to get it all running. I was able to get a desktop running that far exceeded my goals with using HTML on the desktop.
One way I got some really interesting results (though I haven't tried it for years and can't confirm right now that it still works on a modern OS and modern flash player) was to use an active desktop page running a flash swf file that contained a user interface I had created and (at the time I was using it) could launch programs from within the swf.
I ran a setup in a cyber cafe where each desktop was controlled via active desktop running a flash app. Launching and shutdown operations were handled with a mini webserver written in python. The OS was XP.
My experience was that Active Desktop is unreliable. It leaks memory terribly and regularly crashes. They might have fixed it in later versions but since hardly anyway uses it I doubt much effort has gone into fixing its obvious flakiness.
精彩评论