Win8: How do programs like OblyTile and Modern Tile Maker assign tiles to non-Metro app shorcuts?
Asked Answered
N

1

6

We have a .NET but non-Metro app, built in Visual Studio 2010. We would like to show a nice 512x512 (or whatever) image for our app on the Desktop. We do not need Live Tile functionality, we just need a shortcut that shows a nice Metro-dimensioned image. The programs OblyTile and Modern Tile Maker can do this, though it's not clear how. Are they creating an LNK shortcut programatically? Or are they actually shortcuts to themselves (Metro apps) which then launch your legacy app?

If it's the former, then clearly it's possible to create a Metro-dimensioned Desktop icon for a non-Win8 app. How might we script the creation of such a shortcut? We don't care which language we need to use (JScript, C++, C#, whatever), just need to be pointed in the right direction. We use WiX so we've got a lot of flexibility in terms of our install scripting.

Nonna answered 29/3, 2013 at 15:0 Comment(5)
I researched this a while ago, they seem to change the icons and shortcuts directly in the lnk file itself. I think they used the shortcut from IE. You could try to open a modified lnk file in a hex editor and try to figure out what they changed. There doesn't seem to be an official way through an API or something.Durrell
Looking at the link for OblyTile it looks pretty clear that they create LNK file programatically. Also, metro apps can not launch legacy apps, so secondary tile method is out.Unite
@Unite I figured they were creating an LNK programatically. Would love to know how so we can do one for our setup. Curious that they didn't provide support for the many legacy apps out there, to look nice on the desktop without being rewritten as Metro :)Nonna
OblyTile support command line mode. So you could distribute it with your app installer and just call it to create the start screen tile as part of the install process.Unite
MS should have changed .lnk to an XML format years ago.Yanez
B
3

There are a few things going on here:

1) You can view the source code for OblyApp by downloading ILSpy: http://ilspy.net/

2) The OblyApp creates a tile which runs a VBS file (Launcher.vbs) which launches the specified app. OblyApp creates a new unique launcher.vbs file for each tile, and also saves images for each of the tiles it creates under c:\Program Files\OblyTile\<Folder like 00000001>. Text of the vbs file:

On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strApp = "<path to executable>"

arrPath = Split(strApp, "\")

For i = 0 to Ubound(arrPath) - 1
    strAppPath = strAppPath & arrPath(i) & "\"
Next 

objShell.CurrentDirectory = strAppPath
objShell.Run """<path to executable>""" & ""
If Err.Number <> 0 Then
  If InStr(1, strApp, "/") > 0 then
  Else
      If InStr(1, strApp, "www.") > 0 then
      Else
          If InStr(1, strApp, "shell:") > 0 then
          Else
              If objFSO.folderExists(strApp) Then
              Else
                  If objFSO.FileExists(strApp) Then
                  Else
                      MsgBox strApp & " not found", 16, "OblyTile"
                  End If
              End If
          End If
      End If
  End If
Err.Clear
End If

3) I believe that they are copying an existing .lnk file and changing its associated information in binary. The associated code for this is in the CreaRisorce() and CreateShortcutWinAppClick() methods. There's an official file format for .lnk files here: http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/[MS-SHLLINK].pdf

Bossuet answered 31/10, 2014 at 17:37 Comment(5)
Thanks Matt. I have actually already looked at the source and saw some (but not all) of those things :) A couple of questions, given the aim of the bounty: (a) how do they create the tile? I can see the images etc, but... where and how it is created and linked to those images and caption? And (b) I did see the CreaRisorce function but deciphering it... agh. Can you include some of the code that actually manipulates the link? Are they using IShellLink, or writing it in binary (you say this) and if so which parts?Bradeord
I'll have to do this next week, going on vacation in an hour. :-) Hope the bounty is still here.Bossuet
No worries; the bounty is open for 6 days, but if no-one else answers I'll award it to you if you're still on holiday and haven't added that yet, for what you will write when you're back ;)Bradeord
The bounty ended, so I awarded it to your answer. It would be great if you can expand any more of it (and thankyou!) Meanwhile, enjoy the rest of your holiday.Bradeord
I just got back from vacation, I'll see what more I can dig up this week.Bossuet

© 2022 - 2024 — McMap. All rights reserved.