Few useful codes that people may like (stop Alt-F4, start up process start) 01-15-2011, 02:56 PM
#1
hey no matter what forum you go to i always see threads like How to add to start up or how to disable alt-f4 or even how to make a program run so here they are
disable ALT-f4
--------------------------------------------------------------------------------------------------------------
If e.KeyData = Keys.Alt + Keys.F4 Then
MessageBox.Show("Error 33589", "Security Unable to close", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Handled = True
End If
--------------------------------------------------------------------------------------------------------------
add to start up folder
----------------------------------------------------------------------------------------------------------
Dim startup
startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup)
System.IO.File.Copy(Application.ExecutablePath, startup & "\YourProgram.exe")
----------------------------------------------------------------------------------------------------------
add to current user start up
----------------------------------------------------------------------------------------------------------
Dim filename As String
Dim filepath As Object
Dim registrykey As Object
filename = "Program_name"
filepath = Path.GetFullPath(filename)
registrykey = CreateObject("wscript.shell")
registrykey.regwrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\run\Program_name", filepath)
----------------------------------------------------------------------------------------------------------
program start (easily edited)
----------------------------------------------------------------------------------------------------------
'if a button
process.start("chrome")
'or type and start
if textbox1.text = "Google chrome" then
process.start("Chrome")
end if
----------------------------------------------------------------------------------------------------------
disable ALT-f4
--------------------------------------------------------------------------------------------------------------
If e.KeyData = Keys.Alt + Keys.F4 Then
MessageBox.Show("Error 33589", "Security Unable to close", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Handled = True
End If
--------------------------------------------------------------------------------------------------------------
add to start up folder
----------------------------------------------------------------------------------------------------------
Dim startup
startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup)
System.IO.File.Copy(Application.ExecutablePath, startup & "\YourProgram.exe")
----------------------------------------------------------------------------------------------------------
add to current user start up
----------------------------------------------------------------------------------------------------------
Dim filename As String
Dim filepath As Object
Dim registrykey As Object
filename = "Program_name"
filepath = Path.GetFullPath(filename)
registrykey = CreateObject("wscript.shell")
registrykey.regwrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\run\Program_name", filepath)
----------------------------------------------------------------------------------------------------------
program start (easily edited)
----------------------------------------------------------------------------------------------------------
'if a button
process.start("chrome")
'or type and start
if textbox1.text = "Google chrome" then
process.start("Chrome")
end if
----------------------------------------------------------------------------------------------------------
![[Image: 6caf54.gif]](http://i25.lulzimg.com/6caf54.gif)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)