Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

Start when Windows Starts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JezB - 23 Mar 2006 17:41 GMT
I want to add a checkbox preference to my windows app :

   Start When Windows Starts

How can I ensure that the program is indeed started when windows starts when
the preference is set (rather than just rely on the user adding it to his
Startup program group).
Patrice - 23 Mar 2006 17:44 GMT
You could use the Run registry key :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/setupapi/setup/
run_and_runonce_registry_keys.asp


>I want to add a checkbox preference to my windows app :
>
[quoted text clipped - 3 lines]
> when the preference is set (rather than just rely on the user adding it to
> his Startup program group).
JezB - 24 Mar 2006 10:48 GMT
That works, but if I turn off the setting how can I delete such a key in the
registry? The command:

Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run").DeleteValue("myKey");

throws an exception about permissions.

> You could use the Run registry key :
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/setupapi/setup/
run_and_runonce_registry_keys.asp

[quoted text clipped - 6 lines]
>> when the preference is set (rather than just rely on the user adding it
>> to his Startup program group).
Claes Bergefall - 24 Mar 2006 15:58 GMT
You need to open it as writeable:
Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run",
true).DeleteValue("myKey");

  /claes

> That works, but if I turn off the setting how can I delete such a key in
> the registry? The command:
[quoted text clipped - 13 lines]
>>> when the preference is set (rather than just rely on the user adding it
>>> to his Startup program group).
JezB - 27 Mar 2006 00:23 GMT
Doh! Now I feel silly.

Cheers mate.

> You need to open it as writeable:
> Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run",
[quoted text clipped - 19 lines]
>>>> when the preference is set (rather than just rely on the user adding it
>>>> to his Startup program group).
Zoodor - 24 Mar 2006 12:42 GMT
You could always put a shortcut in the startup folder (C:\Documents and
Settings\All Users\Start Menu\Programs\Startup) if you didn't want to play
around with the registry.

> I want to add a checkbox preference to my windows app :
>
[quoted text clipped - 3 lines]
> the preference is set (rather than just rely on the user adding it to his
> Startup program group).

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.