Click here to Skip to main content
15,041,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have created an vb.net application which must run automatically when windows start after application has been launched(ie. setup has been deployed) and the machine must turn off after the appliaction has exited.
I am confused to make these programe.ie.i dont know how to use REGISTRY...
Thant means I want make entry into registry with data value must be the application exe path ie.the path must be the application folder wherever the application is installed.
So please I need a help...Thanks.
Posted
Updated 14-Sep-11 20:11pm
v2
Comments
Prerak Patel 12-Sep-11 7:47am
   
Turn off machine when application is exited?! Why?

   
Comments
Yashodip Jagdale 13-Sep-11 6:27am
   
But sir,
I want to edit registry at the time of setup deployement and it must be removed when I want to remove the application.Then how to make the SETUP which can add/modify registry during installation/Uninstallation...Please help me sir..Thank you.
simple way is

open regedit from run

go to
SOFTWARE\Microsoft\Windows\CurrentVersion\Run

right click -> new -> string Value -> give name (like "DEMO") ->
right click on Demo -> modify -> paste your exe file in value data (like c:\project\hello.exe) -> ok and restart your PC.
   
Hello
See Registry example http://www.codeproject.com/KB/vb/registry_with_vb.aspx

To run application on window startup
Sample Code.
VB
'Write to register
Dim regKey As Microsoft.Win32.RegistryKeyregKey
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue("YourApplicationName", "YourInstallPath")
regKey.Close()


If you want to remove from register use this code.
VB
regKey.DeleteValue("YourApplicationName", False)


Also look at this Link : http://oreilly.com/pub/a/oreilly/windows/ron/startup_0401.html
   
Another method without using registry is to create a shortcut in Windows Startup Folder.

You can do this when you create installation file in Setup Project in Visual Studio. After you created a project, you can add startup folder into special folders (default: Desktop, and Program File).
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900