How to create a manifest file with code

http://erge32.blogspot.com In this article I do not discuss again what is manifest file functions because of my previous article already exists precisely here, so now the discussion is how to incorporate into a Visual Basic project, so the Manifest file is created automatically if removed.
for those of you who are interested in this tip, please follow the way of making the code below

Step 1
  • create a new standard exe project
  • add module
Step 2
Place the following code in the module project

Option Explicit
Private Declare Function InitCommonControls Lib "Comctl32.dll" () As Long

Sub InitialiseXPControls()
Dim intFreeFile As Integer
Dim lngReturn As Long
Dim strEXEFile As String
Dim strManifestFile As String

strEXEFile = App.Path & "\" & App.EXEName & ".exe"
strManifestFile = strEXEFile & ".manifest"

If Dir(strEXEFile) <> "" And Dir(strManifestFile) = "" Then
intFreeFile = FreeFile()

Open strManifestFile For Output As #intFreeFile
Print #intFreeFile, "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>"
Print #intFreeFile, "<assembly xmlns=""urn:schemas-microsoft-com:asm.v1"" manifestVersion=""1.0"">"
Print #intFreeFile, "<assemblyIdentity"
Print #intFreeFile, " version = ""1.0.0.0"""
Print #intFreeFile, " processorArchitecture = ""X86"""
Print #intFreeFile, " name = ""Microsoft.Winweb.VB_Application"""
Print #intFreeFile, " type=""win32"""
Print #intFreeFile, "/>"
Print #intFreeFile, "<description>GSoftware</description>"
Print #intFreeFile, "<dependency>"
Print #intFreeFile, " <dependentAssembly>"
Print #intFreeFile, " <assemblyIdentity"
Print #intFreeFile, " type=""win32"""
Print #intFreeFile, " name = ""Microsoft.Windows.Common-Controls"""
Print #intFreeFile, " version = ""6.0.0.0"""
Print #intFreeFile, " processorArchitecture = ""X86"""
Print #intFreeFile, " publicKeyToken = ""6595b64144ccf1df"""
Print #intFreeFile, " language = ""*"""
Print #intFreeFile, " />"
Print #intFreeFile, " </dependentAssembly>"
Print #intFreeFile, "</dependency>"
Print #intFreeFile, "</assembly>"
Close #intFreeFile

Shell strEXEFile, vbNormalFocus
End
End If

lngReturn = InitCommonControls()
End Sub


Step 3
Please call InitialiseXPControls in sub main or startup form your project

Now your application will follow the theme of your windows that apply, good luck. If you have any problems please contact me or can you confirm by email, may be useful for you.

Contoh Encrypt dan Decrypt Teks dengan Visual Basic

http://erge32.blogspot.com Tujuan Utama Encrypt dan Descript teks adalah untuk merubah karakter teks sehingga tidak mudah dibaca atau dipahami orang lain, metode ini banyak dipakai untuk proteksi seperti dunia Internet, Bank baik proteksi password, pengiriman pesan, pengiriman data dan lain-lain. Disini saya memberikan contoh dasar bagaimana pembuatan Encrypt dan Descript teks tersebut dengan Visual Basic

Sintax :
1. EncryptText(strText As String, ByVal strPwd As String) As String
2. DecryptText(strText As String, ByVal strPwd As String)

contoh :
EncryptText("Uji Coba", "gila") = ž¶ªgŒ»£¨
DecryptText("ž¶ªgŒ»£¨","gila") = Uji Coba

Bagi sobat-sobat yang tertarik silakan ikuti langkah - langkah pembuatan fungsi Encrypt dan Decript ini

Persiapan yang harus dilakukan
  • Buat Project Baru Standart Exe
  • 3 Buah TextBox (Text1,Text2, Text3)
  • 2 Buah CommandButton (Command1, Command2)
  • 2 Buah Label
  • 1 buat Moudule
  • Design form seperti Gambar dibawah ini
Contoh Design Project Form Engcrypt - Descrypt


Tempat Coding dibawah ini pada Module
Option Explicit

#Const CASE_SENSITIVE_PASSWORD = False

'Encrypt text
Public Function EncryptText(strText As String, ByVal strPwd As String) As String
Dim i As Integer, c As Integer
Dim strBuff As String

#If Not CASE_SENSITIVE_PASSWORD Then

'Convert password to upper case
'if not case-sensitive
strPwd = UCase$(strPwd)

#End If

'Encrypt string
If Len(strPwd) Then
For i = 1 To Len(strText)
c = Asc(Mid$(strText, i, 1))
c = c + Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
strBuff = strBuff & Chr$(c And &HFF)
Next i
Else
strBuff = strText
End If
EncryptText = strBuff
End Function

Public Function DecryptText(strText As String, ByVal strPwd As String)
Dim i As Integer, c As Integer
Dim strBuff As String

#If Not CASE_SENSITIVE_PASSWORD Then

'Convert password to upper case
'if not case-sensitive
strPwd = UCase$(strPwd)

#End If

'Decrypt string
If Len(strPwd) Then
For i = 1 To Len(strText)
c = Asc(Mid$(strText, i, 1))
c = c - Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
strBuff = strBuff & Chr$(c And &HFF)
Next i
Else
strBuff = strText
End If
DecryptText = strBuff
End Function

Ketik Coding dibawah ini pada Form Project

Option Explicit

Private Sub Command1_Click()
Text2 = EncryptText(Text1, "gila")
End Sub

Private Sub Command2_Click()
Text3 = DecryptText(Text2, "gila")
End Sub

Cukup sekian dulu tutorial singkat ini, mudah-mudahan ada mamfaat nya bagi sobat - sobat VB Depeloper, selamat mencoba ... salam





Selamat Datang di Blog MainTracker™
 
Free Joomla TemplatesFree Blogger TemplatesFree Website TemplatesFreethemes4all.comFree CSS TemplatesFree Wordpress ThemesFree Wordpress Themes TemplatesFree CSS Templates dreamweaverSEO Design