ROSTAM2
یک شنبه 15 مرداد 1391, 00:38 صبح
http://axgig.com/images/84593201666687114749.jpg
Form2 Code
Public Class Form2
Public Property FilePath() As String
Get
Return TextBox1.Text
End Get
Set(ByVal value As String)
TextBox1.Text = value
End Set
End Property
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ofd As New OpenFileDialog With {.Filter = "All Files|*.*"}
With ofd
If .ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub
FilePath = .FileName
End With
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' Convert File to Byte
Dim B() As Byte = IO.File.ReadAllBytes(FilePath)
With My.Computer.Registry.ClassesRoot
For Each k In .GetSubKeyNames
If k = ExtensionBox.Text Then GoTo JustDo
Next
.CreateSubKey(ExtensionBox.Text).CreateSubKey("ShellNew").SetValue("Data", B, Microsoft.Win32.RegistryValueKind.Binary)
.CreateSubKey(FileTypeBox.Text).SetValue("", FileTypeDescriptionBox.Text)
JustDo:
.OpenSubKey(ExtensionBox.Text, True).CreateSubKey("ShellNew").SetValue("Data", B, Microsoft.Win32.RegistryValueKind.Binary)
End With
End Sub
End Class
ابتدا تبديل فايل به byte بعد ايجاد ShellNew براي قالب فايلي كه تعيين شده و وارد كردن اطلاعات تبيدل شده فايل به صورت Binaryدر يك Valueبا نام Data
http://axgig.com/images/00321365408005706653.png
http://rostam2.persiangig.com/other/Form2.zip
Form2 Code
Public Class Form2
Public Property FilePath() As String
Get
Return TextBox1.Text
End Get
Set(ByVal value As String)
TextBox1.Text = value
End Set
End Property
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ofd As New OpenFileDialog With {.Filter = "All Files|*.*"}
With ofd
If .ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub
FilePath = .FileName
End With
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' Convert File to Byte
Dim B() As Byte = IO.File.ReadAllBytes(FilePath)
With My.Computer.Registry.ClassesRoot
For Each k In .GetSubKeyNames
If k = ExtensionBox.Text Then GoTo JustDo
Next
.CreateSubKey(ExtensionBox.Text).CreateSubKey("ShellNew").SetValue("Data", B, Microsoft.Win32.RegistryValueKind.Binary)
.CreateSubKey(FileTypeBox.Text).SetValue("", FileTypeDescriptionBox.Text)
JustDo:
.OpenSubKey(ExtensionBox.Text, True).CreateSubKey("ShellNew").SetValue("Data", B, Microsoft.Win32.RegistryValueKind.Binary)
End With
End Sub
End Class
ابتدا تبديل فايل به byte بعد ايجاد ShellNew براي قالب فايلي كه تعيين شده و وارد كردن اطلاعات تبيدل شده فايل به صورت Binaryدر يك Valueبا نام Data
http://axgig.com/images/00321365408005706653.png
http://rostam2.persiangig.com/other/Form2.zip