Home All Groups Group Topic Archive Search About
Author
8 Apr 2005 5:57 AM
Doug Bell
Hi,
I have a small application with a User Settings form
I would like to give the Users the ability to (at any time) set the
Application to load when the PC is started.

Can someone point me in the direction of how to create a Short Cut and place
it in the folder "C:\Documents and Settings\'User Name'\Start Menu\"
or am I better off setting/unsetting a registry entry somewhere? (noting
that most Users will not have Administrator priviledges.

Thanks

Doug

Author
8 Apr 2005 7:37 AM
Peter Proost
Hi,

I think a normal user always has the right to write to  this registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\

If you create a new key there with the name of your exe and in the value the
path to your exe, it will auto-start

hth

Greetz Peter

Show quoteHide quote
"Doug Bell" <d**@bigpond.com> schreef in bericht
news:OHKZr$$OFHA.2132@TK2MSFTNGP14.phx.gbl...
> Hi,
> I have a small application with a User Settings form
> I would like to give the Users the ability to (at any time) set the
> Application to load when the PC is started.
>
> Can someone point me in the direction of how to create a Short Cut and
place
> it in the folder "C:\Documents and Settings\'User Name'\Start Menu\"
> or am I better off setting/unsetting a registry entry somewhere? (noting
> that most Users will not have Administrator priviledges.
>
> Thanks
>
> Doug
>
>
Author
8 Apr 2005 8:10 AM
Doug Bell
Thanks Peter,
I have just been search to find a way to write to Registry.
In VB VBA I used to call a Windows API but I hope that VB .Net does not
require this.
I found:
SaveSettingAppName, Section, Key, Setting)

but this does not allow you to select the correct section
(Software\Microsoft\Windows\CurrentVersion\Run)

It writes to Software\VB and VBA Program Settings\'AppName'\'Section'\'Key'



Doug


Show quoteHide quote
"Peter Proost" <pproost@nospam.hotmail.com> wrote in message
news:e5e0G4APFHA.2532@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I think a normal user always has the right to write to  this registry key:
> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\
>
> If you create a new key there with the name of your exe and in the value
the
> path to your exe, it will auto-start
>
> hth
>
> Greetz Peter
>
> "Doug Bell" <d**@bigpond.com> schreef in bericht
> news:OHKZr$$OFHA.2132@TK2MSFTNGP14.phx.gbl...
> > Hi,
> > I have a small application with a User Settings form
> > I would like to give the Users the ability to (at any time) set the
> > Application to load when the PC is started.
> >
> > Can someone point me in the direction of how to create a Short Cut and
> place
> > it in the folder "C:\Documents and Settings\'User Name'\Start Menu\"
> > or am I better off setting/unsetting a registry entry somewhere? (noting
> > that most Users will not have Administrator priviledges.
> >
> > Thanks
> >
> > Doug
> >
> >
>
>
>
Author
8 Apr 2005 8:44 AM
Peter Proost
Hi Doug,

maybe this helps:

Imports Microsoft.Win32

Dim oRegKey As RegistryKey
Dim oBaseKey As RegistryKey

oBaseKey = Registry.CurrentUser
oRegKey =
oBaseKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)

If Not oRegKey Is Nothing Then
    'Read the value
    Dim val As Object = oRegKey.GetValue("YourValueName")
    msgbox(CStr(val))

    'Set the value
     oRegKey.SetValue("YourValueName", "your path")
End If

hth Peter



"Doug Bell" <d**@bigpond.com> schreef in bericht
news:ukZlCKBPFHA.1884@TK2MSFTNGP15.phx.gbl...
> Thanks Peter,
> I have just been search to find a way to write to Registry.
> In VB VBA I used to call a Windows API but I hope that VB .Net does not
> require this.
> I found:
> SaveSettingAppName, Section, Key, Setting)
>
> but this does not allow you to select the correct section
> (Software\Microsoft\Windows\CurrentVersion\Run)
>
> It writes to Software\VB and VBA Program
Settings\'AppName'\'Section'\'Key'
Show quoteHide quote
>
>
>
> Doug
>
>
> "Peter Proost" <pproost@nospam.hotmail.com> wrote in message
> news:e5e0G4APFHA.2532@TK2MSFTNGP09.phx.gbl...
> > Hi,
> >
> > I think a normal user always has the right to write to  this registry
key:
> > HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\
> >
> > If you create a new key there with the name of your exe and in the value
> the
> > path to your exe, it will auto-start
> >
> > hth
> >
> > Greetz Peter
> >
> > "Doug Bell" <d**@bigpond.com> schreef in bericht
> > news:OHKZr$$OFHA.2132@TK2MSFTNGP14.phx.gbl...
> > > Hi,
> > > I have a small application with a User Settings form
> > > I would like to give the Users the ability to (at any time) set the
> > > Application to load when the PC is started.
> > >
> > > Can someone point me in the direction of how to create a Short Cut and
> > place
> > > it in the folder "C:\Documents and Settings\'User Name'\Start Menu\"
> > > or am I better off setting/unsetting a registry entry somewhere?
(noting
> > > that most Users will not have Administrator priviledges.
> > >
> > > Thanks
> > >
> > > Doug
> > >
> > >
> >
> >
> >
>
>
Author
8 Apr 2005 9:01 AM
Doug Bell
Peter thanks,

I was just about to post that I had found that.
I am starting to build a class as a wrapper to Create, Read, Write, and
Delete Keys

So that I can re-use it.

Thanks for your responses.

Doug


Show quoteHide quote
"Peter Proost" <pproost@nospam.hotmail.com> wrote in message
news:%23OUHXdBPFHA.2432@TK2MSFTNGP10.phx.gbl...
> Hi Doug,
>
> maybe this helps:
>
> Imports Microsoft.Win32
>
> Dim oRegKey As RegistryKey
> Dim oBaseKey As RegistryKey
>
> oBaseKey = Registry.CurrentUser
> oRegKey =
> oBaseKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
>
> If Not oRegKey Is Nothing Then
>     'Read the value
>     Dim val As Object = oRegKey.GetValue("YourValueName")
>     msgbox(CStr(val))
>
>     'Set the value
>      oRegKey.SetValue("YourValueName", "your path")
> End If
>
> hth Peter
>
>
>
> "Doug Bell" <d**@bigpond.com> schreef in bericht
> news:ukZlCKBPFHA.1884@TK2MSFTNGP15.phx.gbl...
> > Thanks Peter,
> > I have just been search to find a way to write to Registry.
> > In VB VBA I used to call a Windows API but I hope that VB .Net does not
> > require this.
> > I found:
> > SaveSettingAppName, Section, Key, Setting)
> >
> > but this does not allow you to select the correct section
> > (Software\Microsoft\Windows\CurrentVersion\Run)
> >
> > It writes to Software\VB and VBA Program
> Settings\'AppName'\'Section'\'Key'
> >
> >
> >
> > Doug
> >
> >
> > "Peter Proost" <pproost@nospam.hotmail.com> wrote in message
> > news:e5e0G4APFHA.2532@TK2MSFTNGP09.phx.gbl...
> > > Hi,
> > >
> > > I think a normal user always has the right to write to  this registry
> key:
> > > HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\
> > >
> > > If you create a new key there with the name of your exe and in the
value
> > the
> > > path to your exe, it will auto-start
> > >
> > > hth
> > >
> > > Greetz Peter
> > >
> > > "Doug Bell" <d**@bigpond.com> schreef in bericht
> > > news:OHKZr$$OFHA.2132@TK2MSFTNGP14.phx.gbl...
> > > > Hi,
> > > > I have a small application with a User Settings form
> > > > I would like to give the Users the ability to (at any time) set the
> > > > Application to load when the PC is started.
> > > >
> > > > Can someone point me in the direction of how to create a Short Cut
and
> > > place
> > > > it in the folder "C:\Documents and Settings\'User Name'\Start Menu\"
> > > > or am I better off setting/unsetting a registry entry somewhere?
> (noting
> > > > that most Users will not have Administrator priviledges.
> > > >
> > > > Thanks
> > > >
> > > > Doug
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>
>