26-03-13, 12:38 PM
Easy 4ever كتب :المعذره أخي لم أركز في الكودشكرآ اخى
أنظر لهذا الموضوع
لاكن يوجد مشكله بلا الكود هى
كود :
W.regwrite("HKCR\" & E, Extension & " File")كود :
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Public Class Form1
Inherits System.Windows.Forms.Form
Sub NewFileType(ByRef ProgramPath As String, ByVal Extension As String _
, ByRef FileIcon As String, ByRef Description As String)
Dim W As Object
Dim E As String
W = CreateObject("Wscript.shell")
If VB.Left(Extension, 1) <> "." Then
E = "." & Extension & "\"
Else
E = Extension & "\"
Extension = Mid(Extension, 2)
End If
W.regwrite("HKCR\" & E, Extension & " File")
W.regwrite("HKCR\" & Extension & " File\", Description)
W.regwrite("HKCR\" & Extension & " File\DefaultIcon\", FileIcon)
W.regwrite("HKCR\" & Extension & " File\Shell\Open\Command\", ProgramPath & " %1")
W.regwrite("HKCR\" & Extension & " File\Shell\", "Open")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim co As New ColorDialog
If co.ShowDialog = Windows.Forms.DialogResult.OK Then
Me.RichTextBox1.SelectionColor = co.Color
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As New SaveFileDialog
s.Filter = " ملفات مفكرة أنس(ans)|*.ans"
If s.ShowDialog = Windows.Forms.DialogResult.OK Then
Me.RichTextBox1.SaveFile(s.FileName)
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
NewFileType((Application.ExecutablePath), ("ans") _
, ("C:\Users\kkkkkkkkk\Downloads\myico.ico"), ("C:\Users\kkkkkkkkk\Desktop"))
MsgBox("تم الاعداد بنجاح")
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Trim(VB.Command()) <> "" Then
If VB.Right(Trim(VB.Command()), 3) = "ans" Then
If Dir(Trim(VB.Command())) <> "" Then
Try
RichTextBox1.LoadFile(Trim(VB.Command()))
Catch ex As Exception
Try
RichTextBox1.LoadFile(Trim(VB.Command()))
Catch eh As Exception
Me.RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(Trim(VB.Command()))
End Try
End Try
End If
End If
End If
End Sub
End Class