Now iTunes for Windows Can Be Downloaded from Microsoft App Store as a Package, Registry Path to itunes.exe is Broken

  • Thread starter Thread starter Larry G. Robertson
  • Start date Start date
L

Larry G. Robertson

Guest
This may be old news but on or about 3/28/2019 iTunes on my Windows 10 1809 computer kept asking me to download a new version. Even if I checked the box that says "Do not ask again" it still asks you to update, so finally I did.

I was surprised to find out that you can download iTunes for Windows from the Microsoft App Store. I can only assume that a new deal was made between Microsoft and Apple. As a result iTunes is now installed as a Microsoft Package Application.

You may ask "What does this have to do with Visual Basic?"

It just so happens that the Visual Basic Application I have been working on for a couple of months was suddenly broken. The application includes a function that detects if iTunes is installed on the customer's computer, and if not I inform the user that "iTunes is not installed".

The chances are maybe someone else out there may run across this problem as well so for that reason I am posting my solution.

If you feel I have posted this in the wrong place please tell me where I should move it too.

Here is the function that returns the full path to itunes.exe either the old versions or the new MS Package version (12.9.4.102). The function returns nothing if iTunes is not installed.

Private Function GetItunesEXEPath() As String
mstrITunesEXEPath = Nothing
' If installed by iTunesSetup exe
mstrITunesEXEPath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\iTunes.exe", Nothing, Nothing)
If mstrITunesEXEPath Is Nothing Then
' If Downloaded from the Microsoft Store Package
Dim rootKey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages", False)
Dim allvalues As String = ""
Dim keys As String() = rootKey.GetSubKeyNames
For Each key As String In keys
If key.Contains("AppleInc.iTunes") And Not (key.Contains("neutral")) Then
Return My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages\" & key, "Path", Nothing) & "\iTunes.exe"
Exit For
End If
Next
End If
Return Nothing
End Function

Continue reading...
 
Back
Top