|
-
Nov 2nd, 2005, 05:36 PM
#1
Thread Starter
Hyperactive Member
better way
what is a better way to write this, i want it to be able to read the file, then replace the text in the file.
VB Code:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
IO.File.Delete("dtmbuffer.txt")
IO.File.Copy("dtm.txt", "dtmbuffer.txt")
Dim dtm As IO.StreamReader = IO.File.OpenText("dtmbuffer.txt")
Dim dtm2 As IO.StreamWriter = IO.File.AppendText("dtm.txt")
Try
Select Case dtm.ReadLine()
Case Is = 1
MsgBox("Task Manager is already disabled.")
Me.Close()
Case Is = 0
Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System", True).SetValue("disabletaskmgr", "1")
dtm2.WriteLine("1")
MsgBox("Task Manager is now disabled.")
Me.Close()
End Select
Catch ex As Exception
End Try
End Sub
"Anybody can get angry or sad and frown but it takes a person with character to smile when times are hard."
-
Nov 2nd, 2005, 05:50 PM
#2
Re: better way
Why don't you query the registry to begin with, rather than depending on a text file?
-
Nov 2nd, 2005, 05:55 PM
#3
Thread Starter
Hyperactive Member
Re: better way
very very good idea, thanks
"Anybody can get angry or sad and frown but it takes a person with character to smile when times are hard."
-
Nov 2nd, 2005, 07:01 PM
#4
Thread Starter
Hyperactive Member
Re: better way
how can i check the presense of something in the registry?
"Anybody can get angry or sad and frown but it takes a person with character to smile when times are hard."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|