Sinisterly
Few useful codes that people may like (stop Alt-F4, start up process start) - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework)
+--- Thread: Few useful codes that people may like (stop Alt-F4, start up process start) (/Thread-Few-useful-codes-that-people-may-like-stop-Alt-F4-start-up-process-start)



Few useful codes that people may like (stop Alt-F4, start up process start) - FrostByte_mybb_import5923 - 01-15-2011

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
----------------------------------------------------------------------------------------------------------