?
Solved

Running a program on windows startup and on logging off or shutting down

Posted on 2005-04-23
3
Medium Priority
?
325 Views
Last Modified: 2010-04-17
i have wrote a program that i want to run first when user logsin and then when it shuts down or logs off.....i am using windows xp with visual basic.net....
please guide me.
0
Comment
Question by:neutrongenious
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
InteractiveMind earned 75 total points
ID: 13851179
For logon, just add a String Value to this Registry Key: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
The String Value's value should be the location of your program.

For the logoff/shutdown, see here: http://www.experts-exchange.com/Operating_Systems/WinXP/Q_21195727.html

Regards;
0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 13852840
Hi neutrongenious,

You should write a key in the registry
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Code...

Dim regKey As RegistryKey
Dim ver As Decimal
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue("YourAppName", "C:\FolderName\YourAppExe.EXE")
regKey.Close()


For details... look at
http://www.codeproject.com/vb/net/registry_with_vb.asp

Bye
---
Harish
0
 
LVL 37

Expert Comment

by:Harisha M G
ID: 13852843
neutrongenious,
    Dim ver As Decimal
is not required !!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question