Monday, August 17, 2009

Shell Shortcuts

Windows Mobile shell shortcuts have a very simple file format, something like (taken from my HTC Touch Pro):


The number 22 is supposed to tell us how many characters there are in the string, but this example seems to be wrong. Incidentally, I have seen examples where this value is zero so apparently you can forget about it.

After the # character, you can read the associated command. In this case, you get a "shell macro" that needs to be expanded using a technique that I explained on my previous post. After the ? character there is a module name where the display icon can be found. This section is optional as well as the final section after the comma: the display icon identifier. The negative value means that this is an icon ID and you should be able to feed it directly to the ExtractIconEx API to get the icon handle.

One of the interesting things I've found while doing some research on these files is that you can add a comment section to the beginning of the file, something like:

;Pictures & Videos

Interesting, huh?

I'm putting together a very simple application launcher that uses this knowledge to read from the Program Files directory all the existing shell shortcuts and displays them on a touch list with the right icon and name. This will be published on my next post, so stay tuned.

No comments: