Gå til innhold

Anbefalte innlegg

Videoannonse
Annonse

Du må legge til en manifest fil i samme mappe som programmet som da definerer hvilken Microsoft Windows Common Controls versjon som skal brukes:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
  version="1.0.0.0"
  processorArchitecture="X86"
  name="Microsoft.VB6.VBnetStyles"
  type="win32"
/>
<description>VBnet Manifest for VB6 IDE</description>
<dependency>
  <dependentAssembly>
    <assemblyIdentity
      type="win32"
      name="Microsoft.Windows.Common-Controls"
      version="6.0.0.0"
      processorArchitecture="X86"
      publicKeyToken="6595b64144ccf1df"
      language="*"
    />
  </dependentAssembly>
</dependency>
</assembly>

 

Kall filen for "[EXE-navn].manifest". Et program ved navn "Calc.exe" vil ha manifest-navn "Calc.exe.manifest".

 

Skal du istedenfor la programmet selv sjekke om denne filen eksisterer, og så lage den, kan du bruke denne koden:

 

Public Function IsCodeCompiled() As Boolean

On Error GoTo ErrorHandler

Debug.Print 1 / 0
IsCodeCompiled = True
Exit Function

ErrorHandler:

End Function

Public Sub CheckForManifest()

Dim Path$

If IsCodeCompiled = False Then Exit Sub
Path = App.Path & "\" & App.EXEName & ".exe.manifest"

If Dir(Path) = "" Then

Open Path For Output As #1
Print #1, "<?xml version=" & Chr(34); "1.0" & Chr(34); " encoding=" & Chr(34) & "UTF-8" & Chr(34) & " standalone=" & Chr(34); "yes" & Chr(34); "?>"
Print #1, "<assembly xmlns=" & Chr(34) & "urn:schemas-microsoft-com:asm.v1" & Chr(34) & " manifestVersion=" & Chr(34) & "1.0" & Chr(34); ">"
Print #1, "<assemblyIdentity"
Print #1, "   version=" & Chr(34) & "1.0.0.0" & Chr(34)
Print #1, "   processorArchitecture=" & Chr(34) & "X86" & Chr(34)
Print #1, "   name=" & Chr(34) & "Microsoft.VB6.VBnetStyles" & Chr(34)
Print #1, "   type=" & Chr(34) & "win32" & Chr(34)
Print #1, "/>"
Print #1, "<description>VBnet Manifest for VB6 IDE</description>"
Print #1, "<dependency>"
Print #1, "   <dependentAssembly>"
Print #1, "     <assemblyIdentity"
Print #1, "       type=" & Chr(34) & "win32" & Chr(34)
Print #1, "       name=" & Chr(34) & "Microsoft.Windows.Common-Controls" & Chr(34)
Print #1, "       version=" & Chr(34) & "6.0.0.0" & Chr(34)
Print #1, "       processorArchitecture=" & Chr(34) & "X86" & Chr(34)
Print #1, "       publicKeyToken=" & Chr(34) & "6595b64144ccf1df" & Chr(34)
Print #1, "       language=" & Chr(34) & "*" & Chr(34)
Print #1, "     />"
Print #1, "   </dependentAssembly>"
Print #1, "</dependency>"
Print #1, "</assembly>"
Close #1

Shell App.Path & "\" & App.EXEName & ".exe"
End

End If

End Sub

 

I Form_Load eller Main() legger du så denne koden:

 

CheckForManifest

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...