| | |
ENCRYPTION AND DECRYPTION - How to disable the File menu in a Notepad or any file
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
ENCRYPTION AND DECRYPTION - How to disable the File menu in a Notepad or any file
0
#1 Aug 28th, 2006
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!!
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
WILL B WATIN FOR A REPLY
Arjun
PS: Queen of daniweb.. help me out here!!
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
0
#2 Sep 7th, 2006
![]() |
Similar Threads
- YupSearch Toolbar (Viruses, Spyware and other Nasties)
- World Antispy present in my PC! Help!! (Viruses, Spyware and other Nasties)
- please help me remove winfix. here is my log file from Hijack this (Viruses, Spyware and other Nasties)
- I got some problems once again. (Viruses, Spyware and other Nasties)
- Trojan.Downloader.BHO.Req (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: How do I store a 10 lines of sentence in a textbox
- Next Thread: guys help me
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array assignment basic box button buttons center check code component connectionstring convert crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel fade file-dialog firewall folder ftp generatetags hardcopy image images input insert intel isnumericfuntioncall math monitor navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 port problem problemwithinstallation project record reports" savedialog searchvb.net select serial shutdown string survey tcp temp temperature text textbox timer toolbox trim updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





