Otomatik Xp tarzı form ve nesneler

tarih28.10.2008 03:06 — Visual Basic,



Normalinde VB6 da xp stilini kullanabilmek için manifetst dosyasına gerek vardır.Bu kod sayesinde programımız bunu otomatik oluşturacak.


Aşağıdaki Kodları Form1 içine yapıştırın...

Option Explicit

Private Declare Function InitCommonControls Lib "comctl32.dll" () As Long[/vb]


[vb]Private Sub Form_Initialize()

Dim fso As Variant

Dim FName As String


FName = App.Path & "" & App.EXEName & ".exe.Manifest"


Set fso = CreateObject("Scripting.FileSystemObject")


If Not fso.FileExists(FName) Then

CreateManifest FName

MsgBox "Did not find a Manifest file, so one has been created for you." _

& vbCrLf & "XP styles will be applied next time you run this application", _

vbOKOnly + vbInformation, "Application manifest file missing"

Else

InitCommonControls

End If


End Sub


Private Sub CreateManifest(ByVal FilePathAndName As String)

Dim ManifestFile As Integer


ManifestFile = FreeFile

Open FilePathAndName For Append As #ManifestFile

Print #ManifestFile, "

& Chr(34) & "UTF-8" & Chr(34) & " standalone=" & Chr(34) & "yes" & Chr(34) & "?>"

Print #ManifestFile, "

& Chr(34) & " manifestVersion=" & Chr(34) & "1.0" & Chr(34) & ">"

Print #ManifestFile, "

Print #ManifestFile, "version=" & Chr(34) & "1.0.0.0" & Chr(34)

Print #ManifestFile, "processorArchitecture=" & Chr(34) & "X86" & Chr(34)

Print #ManifestFile, "name=" & Chr(34) & "Company Name.Application Name.Application Title" & Chr(34)

Print #ManifestFile, "type=" & Chr(34) & "win32" & Chr(34)

Print #ManifestFile, "/>"

Print #ManifestFile, "You Application Name Here"

Print #ManifestFile, ""

Print #ManifestFile, ""

Print #ManifestFile, "

Print #ManifestFile, "type=" & Chr(34) & "win32" & Chr(34)

Print #ManifestFile, "name=" & Chr(34) & "Microsoft.Windows.Common-Controls" & Chr(34)

Print #ManifestFile, "version=" & Chr(34) & "6.0.0.0" & Chr(34)

Print #ManifestFile, "processorArchitecture=" & Chr(34) & "X86" & Chr(34)

Print #ManifestFile, "publicKeyToken=" & Chr(34) & "6595b64144ccf1df" & Chr(34)

Print #ManifestFile, "language=" & Chr(34) & "*" & Chr(34)

Print #ManifestFile, "/>"

Print #ManifestFile, ""

Print #ManifestFile, ""

Print #ManifestFile, ""


Close #ManifestFile


End Sub




Bir önceki konu başlığımıza göz atmak isterseniz tıklayınız : Her zaman üstte kalan form





Yorum Yazın