Create Short Cut

  • Thread starter Thread starter Doug Bell
  • Start date Start date
D

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