Dim x As String
Dim y As Integer
Dim AppName As String
Dim ManFileName As String
Dim AlreadyExists As String
'Find the name of this application
x = Application.ExecutablePath
y = x.LastIndexOf("\")
y = y + 1
AppName = x.Substring(y, x.Length - y)
'Create the name for the XML file
ManFileName = AppName & ".xml"
'See if the manifest exists
If System.IO.File.Exists(ManFileName) Then
AlreadyExists = "Y"
Else
FileOpen(1, ManFileName, OpenMode.Binary)
FilePut(1, "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" & vbCrLf)
FilePut(1, "<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>" & vbCrLf)
FilePut(1, "<assemblyIdentity version='1.0.0.0' processorArchitecture='X86' name='zx.exe' type='win32' />" & vbCrLf)
FilePut(1, "<description>zxapplication</description>" & vbCrLf)
FilePut(1, "<dependency>" & vbCrLf)
FilePut(1, "<dependentAssembly>" & vbCrLf)
FilePut(1, "<assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*' />" & vbCrLf)
FilePut(1, "</dependentAssembly>" & vbCrLf)
FilePut(1, "</dependency>" & vbCrLf)
FilePut(1, "</assembly>" & vbCrLf)
FileClose(1)
'Open a new instance of the app and close this one
'so the manifest is picked up
Shell(AppName, AppWinStyle.NormalFocus)
End
End If