![]() |
| ||
| ENCRYPTION AND DECRYPTION - How to disable the File menu in a Notepad or any file Hi ppl.. i need a big fat favour from you guys.. The program i given below helps to Encrypt and decrypt any file(EX: Notepad, word.doc, Access) any files.. Ive been ask to do another task along with it.. They have told me to disable t File- Edit-(containing in the Menu field of the Notepad or any file).. so ive been squeezin my brain fr a whole week cudn get anythin done.. help me out guys!!.. all i want is to disable t File(which consists of New,Open, Save n all).. i want to disable those fields wen i run the program.. WILL B WATIN FOR A REPLY Arjun PS: Queen of daniweb.. help me out here!! :sad: Imports System.IO Imports System.Windows.Forms Imports System.runtime.Serialization.formatters.Binary Imports System.runtime.Serialization Imports System Imports System.Drawing Imports System.Collections Imports System.ComponentModel Imports System.Data Imports System.Text Imports System.Runtime.InteropServices Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Btnbrowse As System.Windows.Forms.Button Friend WithEvents BtnOpen As System.Windows.Forms.Button Friend WithEvents Rtblocation As System.Windows.Forms.RichTextBox Friend WithEvents Btnclose As System.Windows.Forms.Button Friend WithEvents Label1 As System.Windows.Forms.Label <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Btnbrowse = New System.Windows.Forms.Button Me.BtnOpen = New System.Windows.Forms.Button Me.Rtblocation = New System.Windows.Forms.RichTextBox Me.Btnclose = New System.Windows.Forms.Button Me.Label1 = New System.Windows.Forms.Label Me.SuspendLayout() ' 'Btnbrowse ' Me.Btnbrowse.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Btnbrowse.Location = New System.Drawing.Point(552, 64) Me.Btnbrowse.Name = "Btnbrowse" Me.Btnbrowse.Size = New System.Drawing.Size(96, 24) Me.Btnbrowse.TabIndex = 1 Me.Btnbrowse.Text = "Select a File " ' 'BtnOpen ' Me.BtnOpen.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.BtnOpen.Location = New System.Drawing.Point(128, 112) Me.BtnOpen.Name = "BtnOpen" Me.BtnOpen.Size = New System.Drawing.Size(104, 32) Me.BtnOpen.TabIndex = 2 Me.BtnOpen.Text = "Open" ' 'Rtblocation ' Me.Rtblocation.AutoSize = True Me.Rtblocation.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Rtblocation.Location = New System.Drawing.Point(16, 64) Me.Rtblocation.Name = "Rtblocation" Me.Rtblocation.Size = New System.Drawing.Size(528, 24) Me.Rtblocation.TabIndex = 4 Me.Rtblocation.Text = "" ' 'Btnclose ' Me.Btnclose.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Btnclose.Location = New System.Drawing.Point(344, 112) Me.Btnclose.Name = "Btnclose" Me.Btnclose.Size = New System.Drawing.Size(96, 32) Me.Btnclose.TabIndex = 5 Me.Btnclose.Text = "Close" ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(264, 24) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(95, 16) Me.Label1.TabIndex = 7 Me.Label1.Text = "DECRYPT TOOL" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(656, 166) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.Btnclose) Me.Controls.Add(Me.Rtblocation) Me.Controls.Add(Me.BtnOpen) Me.Controls.Add(Me.Btnbrowse) Me.Name = "Form1" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Form1" Me.ResumeLayout(False) End Sub #End Region #Region " DLL FOR ENCRYPTION AND DECRYPTION" Public Declare Function ARMEnCrptFile Lib "ArmCrpt.dll" Alias "ARMEnCrptFile" (ByVal SrcFile As String, ByVal SzPass As String, ByVal FileName As String, ByVal CrcPath As String) As Integer Public Declare Function GetFileCRC Lib "ArmCrpt.dll" Alias "GetFileCRC" (ByVal FilePath As String, ByVal CrcVal As String) As String Public Declare Function ARMDeCrptFile Lib "ArmCrpt.dll" Alias "ARMDeCrptFile" (ByVal SrcFile As String, ByVal SzPass As String) As Integer #End Region Private output As FileStream Dim proc As Process Private Sub Btnbrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbrowse.Click Try Rtblocation.Clear() Dim filename As String Dim filechooser As OpenFileDialog = New OpenFileDialog Dim result As DialogResult = filechooser.ShowDialog filechooser.CheckFileExists = False If result = DialogResult.Cancel Then Return End If filename = filechooser.FileName If (filename = "" OrElse filename = Nothing) Then MsgBox("invalid") Else Rtblocation.Text = Trim(filename) End If Catch fileexception As FileLoadException MsgBox(fileexception) End Try End Sub Private Sub BtnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOpen.Click Try Try Dim filename As String Dim FILE_NAME As String = filename BtnOpen.Enabled = False Btnclose.Enabled = False If Rtblocation.Text = "" Then MsgBox("select a file 2 open") BtnOpen.Enabled = True Exit Sub ElseIf System.IO.File.Exists(Rtblocation.Text) = False Then Exit Sub End If Btnbrowse.Enabled = False Call startproc(filename) Catch fileexception As FileLoadException MsgBox(fileexception) End Try Catch fileexception As FileLoadException MsgBox(fileexception) End Try End Sub Private Sub startproc(ByVal str1 As String) Dim proc As Process proc = New Process proc.EnableRaisingEvents = True AddHandler proc.Exited, AddressOf OnProcessExit Dim str As String Call DecryptFiles(str) proc.StartInfo.FileName = Rtblocation.Text proc.StartInfo.ErrorDialog = True proc.Start() End Sub Private Sub OnProcessExit(ByVal sender As Object, ByVal e As EventArgs) Dim proc As Process = CType(sender, Process) proc.GetCurrentProcess.Dispose() Debug.WriteLine(proc.ExitCode) Debug.WriteLine(proc.ExitTime) proc = Nothing Dim filename As String Call EncryptFiles(filename) Call clear() End Sub Private Sub Btnclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnclose.Click Me.Close() Me.Dispose() End Sub Private Sub DecryptFiles(ByVal str As String) Try Me.ARMDeCrptFile(Trim(Rtblocation.Text), "InLoTt123") Catch fileexception As FileLoadException MsgBox(fileexception) End Try End Sub Private Sub EncryptFiles(ByVal filename As String) Me.ARMEnCrptFile(Rtblocation.Text, "InLoTt123", Rtblocation.Text, Rtblocation.Text + "\" + "data.CRC") End Sub Private Sub clear() Rtblocation.Clear() Btnbrowse.Enabled = True BtnOpen.Enabled = True Btnclose.Enabled = True End Sub End Class |
| ||
| Re: ENCRYPTION AND DECRYPTION - How to disable the File menu in a Notepad or any file well its almost a month nw.. n nobody has replied for my queries??.. n i thot dis site was a usefull one.. |
| All times are GMT -4. The time now is 4:20 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC