Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 530
System.Cats.Lol Avatar asked Mar 29 '13 15:03

System.Cats.Lol


1 Answers

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

like image 165
Matt Small Avatar answered Oct 16 '22 09:10

Matt Small