<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Getting a program to start with windows' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Getting a program to start with windows' posted on the 'Evil Scripting' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sun, 26 May 2013 02:08:55 -0700</pubDate>
    <lastBuildDate>Sun, 26 May 2013 02:08:55 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Getting a program to start with windows</title>
      <link>http://www.programmersheaven.com/mb/evilscripting/253736/253736/getting-a-program-to-start-with-windows/</link>
      <description>There are serveral ways to start a program when windows starts. The easiest way to make and remove is the start menu/programs/startup section. Place a link to the program you would like to run and the boot adjustment is ready&lt;br /&gt;
The second option is the c:/windows/win.ini . This file contains a line (second or third) which says RUN= . This line should be altered to RUN="c:\[programdir]\[programname].exe" . If you place the file in one of the environmental variables declared in autoexec.bat (SET=C:\WINDOWS;C:\WINDOWS\COMMAND) In this case (and just about any case) C:\windows or C:\windows\command, you could leave the "C:\[programdir]\" section out of the line. Done!&lt;br /&gt;
The third line is to write a string to the registry, in the [HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CUR
RENTVERSION\RUN] section. Write a string value, with the name you would like to display (Like "Windows Essentials") and assign the program dir and name as the value. Again, if the program is in an environmental variable directory, the directory is not necessary.&lt;br /&gt;
But, how is this done? Quite simple, get a registry acces API, or use regedit :D :&lt;br /&gt;
&lt;pre class="sourcecode"&gt;Public Function install(app As String, name As String)
Open "temp.reg" For Output As #1
Print #1, "REGEDIT4"
Print #1, ""
Print #1, "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Cu
rrentVersion\Run]"
Print #1, Chr(34) &amp;amp; name &amp;amp; Chr(34) &amp;amp; "=" &amp;amp; Chr(34) &amp;amp; app &amp;amp; Chr(34)
Print #1, ""
Print #1, ""
Close #1
Shell "regedit /s temp.reg"
Kill "temp.reg"
End Function&lt;/pre&gt;&lt;br /&gt;
As you see, this is a quite simple function, and it only requires the fake name to display, and the program path.&lt;br /&gt;
That's about all I know about computer booting.&lt;br /&gt;
EtHeO out...&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/evilscripting/253736/253736/getting-a-program-to-start-with-windows/</guid>
      <pubDate>Thu, 08 Apr 2004 08:23:25 -0700</pubDate>
      <category>Evil Scripting</category>
    </item>
    <item>
      <title>Re: Getting a program to start with windows</title>
      <link>http://www.programmersheaven.com/mb/evilscripting/253736/254424/re-getting-a-program-to-start-with-windows/#254424</link>
      <description>There is another way in a module and the code is this.&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
Enum RegHive 
HKEY_CLASSES_ROOT = &amp;amp;H80000000 
HK_CR = &amp;amp;H80000000 
HKEY_CURRENT_USER = &amp;amp;H80000001 
HK_CU = &amp;amp;H80000001 
HKEY_LOCAL_MACHINE = &amp;amp;H80000002 
HK_LM = &amp;amp;H80000002 
HKEY_USERS = &amp;amp;H80000003 
HK_US = &amp;amp;H80000003 
HKEY_CURRENT_CONFIG = &amp;amp;H80000005 
HK_CC = &amp;amp;H80000005 
HKEY_DYN_DATA = &amp;amp;H80000006 
HK_DD = &amp;amp;H80000006 
End Enum 

Enum RegType 
REG_SZ = 1 'Unicode nul terminated string 
REG_BINARY = 3 'Free form binary 
REG_DWORD = 4 '32-bit number 
End Enum 

Public Const ERROR_SUCCESS = 0&amp;amp; 
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long 
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long 
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long 
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long 
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long 
Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long 

Public Function DelRegValue(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String) 
Dim hCurKey As Long 
Dim lRegResult As Long 
lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
lRegResult = RegDeleteValue(hCurKey, strValue) 
lRegResult = RegCloseKey(hCurKey) 
End Function 

Public Function DelRegKey(ByVal hKey As RegHive, ByVal strPath As String) As Long 
Dim lRegResult As Long 
lRegResult = RegDeleteKey(hKey, strPath) 
DelRegKey = lRegResult 
End Function 

Public Function CreateRegKey(hKey As RegHive, strPath As String) 
Dim hCurKey As Long 
Dim lRegResult As Long 
lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
'there is a problem 
End If 
lRegResult = RegCloseKey(hCurKey) 
End Function 
Public Function GetRegString(hKey As RegHive, strPath As String, strValue As String, Optional Default As String) As String 
Dim hCurKey As Long 
Dim lResult As Long 
Dim lValueType As Long 
Dim strBuffer As String 
Dim lDataBufferSize As Long 
Dim intZeroPos As Integer 
Dim lRegResult As Long 
'Set up default value 
If Not IsEmpty(Default) Then 
GetRegString = Default 
Else 
GetRegString = "" 
End If 
lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
lRegResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, lValueType, ByVal 0&amp;amp;, lDataBufferSize) 
If lRegResult = ERROR_SUCCESS Then 
If lValueType = REG_SZ Then 
strBuffer = String(lDataBufferSize, " ") 
lResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, 0&amp;amp;, ByVal strBuffer, lDataBufferSize) 
intZeroPos = InStr(strBuffer, Chr$(0)) 
If intZeroPos &amp;gt; 0 Then 
GetRegString = Left$(strBuffer, intZeroPos - 1) 
Else 
GetRegString = strBuffer 
End If 
End If 
Else 
'there is a problem 
End If 
lRegResult = RegCloseKey(hCurKey) 
End Function 

Public Function SaveRegString(hKey As RegHive, strPath As String, strValue As String, strData As String) 
Dim hCurKey As Long 
Dim lRegResult As Long 
lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
lRegResult = RegSetValueEx(hCurKey, strValue, 0, REG_SZ, ByVal strData, Len(strData)) 
If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
'there is a problem 
End If 
lRegResult = RegCloseKey(hCurKey) 
End Function 

Public Function GetRegLong(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String, Optional Default As Long) As Long 
Dim lRegResult As Long 
Dim lValueType As Long 
Dim lBuffer As Long 
Dim lDataBufferSize As Long 
Dim hCurKey As Long 
'Set up default value 
If Not IsEmpty(Default) Then 
GetRegLong = Default 
Else 
GetRegLong = 0 
End If 
lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
lDataBufferSize = 4 '4 bytes = 32 bits = long 
lRegResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, lValueType, lBuffer, lDataBufferSize) 
If lRegResult = ERROR_SUCCESS Then 
If lValueType = REG_DWORD Then 
GetRegLong = lBuffer 
End If 
Else 
'there is a problem 
End If 
lRegResult = RegCloseKey(hCurKey) 
End Function 

Public Function SaveRegLong(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String, ByVal lData As Long) 
Dim hCurKey As Long 
Dim lRegResult As Long 
lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
lRegResult = RegSetValueEx(hCurKey, strValue, 0&amp;amp;, REG_DWORD, lData, 4) 
If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
'there is a problem 
End If 
lRegResult = RegCloseKey(hCurKey) 
End Function 

Public Function GetRegByte(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValueName As String, Optional Default As Variant) As Variant 
Dim lValueType As Long 
Dim byBuffer() As Byte 
Dim lDataBufferSize As Long 
Dim lRegResult As Long 
Dim hCurKey As Long 
If Not IsEmpty(Default) Then 
If VarType(Default) = vbArray + vbByte Then 
GetRegByte = Default 
Else 
GetRegByte = 0 
End If 
Else 
GetRegByte = 0 
End If 
lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
lRegResult = RegQueryValueEx(hCurKey, strValueName, 0&amp;amp;, lValueType, ByVal 0&amp;amp;, lDataBufferSize) 
If lRegResult = ERROR_SUCCESS Then 
If lValueType = REG_BINARY Then 
ReDim byBuffer(lDataBufferSize - 1) As Byte 
lRegResult = RegQueryValueEx(hCurKey, strValueName, 0&amp;amp;, lValueType, byBuffer(0), lDataBufferSize) 
GetRegByte = byBuffer 
End If 
Else 
'there is a problem 
End If 
lRegResult = RegCloseKey(hCurKey) 
End Function 

Public Function SaveRegByte(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValueName As String, byData() As Byte) 
Dim lRegResult As Long 
Dim hCurKey As Long 
lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
lRegResult = RegSetValueEx(hCurKey, strValueName, 0&amp;amp;, REG_BINARY, byData(0), UBound(byData()) + 1) 
lRegResult = RegCloseKey(hCurKey) 
End Function 

Public Function CopyRegByte(ByVal From_hKey As RegHive, ByVal From_strPath As String, _ 
ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 

If To_hKey = 0 Then 
To_hKey = From_hKey 
Else 
To_hKey = To_hKey 
End If 
If To_strKeyName = "" Then 
To_strKeyName = From_strKeyName 
Else 
To_strKeyName = To_strKeyName 
End If 

Dim mybytes As Variant 
mybytes = GetRegByte(From_hKey, From_strPath, From_strKeyName) 
thelen = UBound(mybytes) 
Dim x() As Byte 
ReDim x(thelen) 
For i = 0 To UBound(mybytes) 
x(i) = mybytes(i) 
Next i 
rslt = SaveRegByte(To_hKey, To_strPath, To_strKeyName, x) 
End Function 

Public Function CopyRegString(ByVal From_hKey As RegHive, ByVal From_strPath As String, _ 
ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 

If To_hKey = 0 Then 
To_hKey = From_hKey 
Else 
To_hKey = To_hKey 
End If 
If To_strKeyName = "" Then 
To_strKeyName = From_strKeyName 
Else 
To_strKeyName = To_strKeyName 
End If 

Dim mystring As String 
mystring = GetRegString(From_hKey, From_strPath, From_strKeyName) 
rslt = SaveRegString(To_hKey, To_strPath, To_strKeyName, mystring) 

End Function 

Public Function CopyRegLong(ByVal hKey As RegHive, ByVal From_strPath As String, _ 
ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 

If To_hKey = 0 Then 
To_hKey = From_hKey 
Else 
To_hKey = To_hKey 
End If 
If To_strKeyName = "" Then 
To_strKeyName = From_strKeyName 
Else 
To_strKeyName = To_strKeyName 
End If 

Dim mylong As Long 
mylong = GetRegLong(From_hKey, From_strPath, From_strKeyName) 
rslt = SaveRegLong(To_hKey, To_strPath, To_strKeyName, mylong) 

End Function 
Public Function GetRegSubKeyList(ByVal hKey As RegHive, ByVal strPath As String) 
On Error Resume Next 
Dim lResult As Long, lKeyValue As Long, lDataTypeValue As Long, lValueLength As Long 
Dim sValue As String, td As Double, i As Long, Ret As Boolean, tmprst() 
Do Until Ret = True 
lResult = RegOpenKey(hKey, strPath, lKeyValue) 
sValue = Space$(2048) 
lValueLength = Len(sValue) 
lResult = RegEnumKey(lKeyValue, i, sValue, lValueLength) 
If (lResult = 0) And (Err.Number = 0) Then 
ReDim Preserve tmprst(i) 
tmprst(i) = Left$(sValue, InStr(sValue, Chr(0)) - 1) 
Else 
Ret = True 
End If 
lResult = RegCloseKey(lKeyValue) 
i = i + 1 
Loop 
GetRegSubKeyList = tmprst 
End Function
&lt;/pre&gt;&lt;br /&gt;
Just wack it in a module and it is done&lt;br /&gt;
from&lt;br /&gt;
mark&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/evilscripting/253736/254424/re-getting-a-program-to-start-with-windows/#254424</guid>
      <pubDate>Mon, 12 Apr 2004 23:38:39 -0700</pubDate>
      <category>Evil Scripting</category>
    </item>
    <item>
      <title>Re: Getting a program to start with windows</title>
      <link>http://www.programmersheaven.com/mb/evilscripting/253736/254428/re-getting-a-program-to-start-with-windows/#254428</link>
      <description>: There is another way in a module and the code is this.&lt;br /&gt;
: &lt;pre class="sourcecode"&gt;
: Enum RegHive 
: HKEY_CLASSES_ROOT = &amp;amp;H80000000 
: HK_CR = &amp;amp;H80000000 
: HKEY_CURRENT_USER = &amp;amp;H80000001 
: HK_CU = &amp;amp;H80000001 
: HKEY_LOCAL_MACHINE = &amp;amp;H80000002 
: HK_LM = &amp;amp;H80000002 
: HKEY_USERS = &amp;amp;H80000003 
: HK_US = &amp;amp;H80000003 
: HKEY_CURRENT_CONFIG = &amp;amp;H80000005 
: HK_CC = &amp;amp;H80000005 
: HKEY_DYN_DATA = &amp;amp;H80000006 
: HK_DD = &amp;amp;H80000006 
: End Enum 
: 
: Enum RegType 
: REG_SZ = 1 'Unicode nul terminated string 
: REG_BINARY = 3 'Free form binary 
: REG_DWORD = 4 '32-bit number 
: End Enum 
: 
: Public Const ERROR_SUCCESS = 0&amp;amp; 
: Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long 
: Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 
: Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long 
: Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long 
: Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 
: Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long 
: Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long 
: Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long 
: 
: Public Function DelRegValue(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String) 
: Dim hCurKey As Long 
: Dim lRegResult As Long 
: lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: lRegResult = RegDeleteValue(hCurKey, strValue) 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: 
: Public Function DelRegKey(ByVal hKey As RegHive, ByVal strPath As String) As Long 
: Dim lRegResult As Long 
: lRegResult = RegDeleteKey(hKey, strPath) 
: DelRegKey = lRegResult 
: End Function 
: 
: Public Function CreateRegKey(hKey As RegHive, strPath As String) 
: Dim hCurKey As Long 
: Dim lRegResult As Long 
: lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
: 'there is a problem 
: End If 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: Public Function GetRegString(hKey As RegHive, strPath As String, strValue As String, Optional Default As String) As String 
: Dim hCurKey As Long 
: Dim lResult As Long 
: Dim lValueType As Long 
: Dim strBuffer As String 
: Dim lDataBufferSize As Long 
: Dim intZeroPos As Integer 
: Dim lRegResult As Long 
: 'Set up default value 
: If Not IsEmpty(Default) Then 
: GetRegString = Default 
: Else 
: GetRegString = "" 
: End If 
: lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: lRegResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, lValueType, ByVal 0&amp;amp;, lDataBufferSize) 
: If lRegResult = ERROR_SUCCESS Then 
: If lValueType = REG_SZ Then 
: strBuffer = String(lDataBufferSize, " ") 
: lResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, 0&amp;amp;, ByVal strBuffer, lDataBufferSize) 
: intZeroPos = InStr(strBuffer, Chr$(0)) 
: If intZeroPos &amp;gt; 0 Then 
: GetRegString = Left$(strBuffer, intZeroPos - 1) 
: Else 
: GetRegString = strBuffer 
: End If 
: End If 
: Else 
: 'there is a problem 
: End If 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: 
: Public Function SaveRegString(hKey As RegHive, strPath As String, strValue As String, strData As String) 
: Dim hCurKey As Long 
: Dim lRegResult As Long 
: lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: lRegResult = RegSetValueEx(hCurKey, strValue, 0, REG_SZ, ByVal strData, Len(strData)) 
: If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
: 'there is a problem 
: End If 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: 
: Public Function GetRegLong(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String, Optional Default As Long) As Long 
: Dim lRegResult As Long 
: Dim lValueType As Long 
: Dim lBuffer As Long 
: Dim lDataBufferSize As Long 
: Dim hCurKey As Long 
: 'Set up default value 
: If Not IsEmpty(Default) Then 
: GetRegLong = Default 
: Else 
: GetRegLong = 0 
: End If 
: lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: lDataBufferSize = 4 '4 bytes = 32 bits = long 
: lRegResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, lValueType, lBuffer, lDataBufferSize) 
: If lRegResult = ERROR_SUCCESS Then 
: If lValueType = REG_DWORD Then 
: GetRegLong = lBuffer 
: End If 
: Else 
: 'there is a problem 
: End If 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: 
: Public Function SaveRegLong(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String, ByVal lData As Long) 
: Dim hCurKey As Long 
: Dim lRegResult As Long 
: lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: lRegResult = RegSetValueEx(hCurKey, strValue, 0&amp;amp;, REG_DWORD, lData, 4) 
: If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
: 'there is a problem 
: End If 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: 
: Public Function GetRegByte(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValueName As String, Optional Default As Variant) As Variant 
: Dim lValueType As Long 
: Dim byBuffer() As Byte 
: Dim lDataBufferSize As Long 
: Dim lRegResult As Long 
: Dim hCurKey As Long 
: If Not IsEmpty(Default) Then 
: If VarType(Default) = vbArray + vbByte Then 
: GetRegByte = Default 
: Else 
: GetRegByte = 0 
: End If 
: Else 
: GetRegByte = 0 
: End If 
: lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: lRegResult = RegQueryValueEx(hCurKey, strValueName, 0&amp;amp;, lValueType, ByVal 0&amp;amp;, lDataBufferSize) 
: If lRegResult = ERROR_SUCCESS Then 
: If lValueType = REG_BINARY Then 
: ReDim byBuffer(lDataBufferSize - 1) As Byte 
: lRegResult = RegQueryValueEx(hCurKey, strValueName, 0&amp;amp;, lValueType, byBuffer(0), lDataBufferSize) 
: GetRegByte = byBuffer 
: End If 
: Else 
: 'there is a problem 
: End If 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: 
: Public Function SaveRegByte(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValueName As String, byData() As Byte) 
: Dim lRegResult As Long 
: Dim hCurKey As Long 
: lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: lRegResult = RegSetValueEx(hCurKey, strValueName, 0&amp;amp;, REG_BINARY, byData(0), UBound(byData()) + 1) 
: lRegResult = RegCloseKey(hCurKey) 
: End Function 
: 
: Public Function CopyRegByte(ByVal From_hKey As RegHive, ByVal From_strPath As String, _ 
: ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
: Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 
: 
: If To_hKey = 0 Then 
: To_hKey = From_hKey 
: Else 
: To_hKey = To_hKey 
: End If 
: If To_strKeyName = "" Then 
: To_strKeyName = From_strKeyName 
: Else 
: To_strKeyName = To_strKeyName 
: End If 
: 
: Dim mybytes As Variant 
: mybytes = GetRegByte(From_hKey, From_strPath, From_strKeyName) 
: thelen = UBound(mybytes) 
: Dim x() As Byte 
: ReDim x(thelen) 
: For i = 0 To UBound(mybytes) 
: x(i) = mybytes(i) 
: Next i 
: rslt = SaveRegByte(To_hKey, To_strPath, To_strKeyName, x) 
: End Function 
: 
: Public Function CopyRegString(ByVal From_hKey As RegHive, ByVal From_strPath As String, _ 
: ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
: Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 
: 
: If To_hKey = 0 Then 
: To_hKey = From_hKey 
: Else 
: To_hKey = To_hKey 
: End If 
: If To_strKeyName = "" Then 
: To_strKeyName = From_strKeyName 
: Else 
: To_strKeyName = To_strKeyName 
: End If 
: 
: Dim mystring As String 
: mystring = GetRegString(From_hKey, From_strPath, From_strKeyName) 
: rslt = SaveRegString(To_hKey, To_strPath, To_strKeyName, mystring) 
: 
: End Function 
: 
: Public Function CopyRegLong(ByVal hKey As RegHive, ByVal From_strPath As String, _ 
: ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
: Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 
: 
: If To_hKey = 0 Then 
: To_hKey = From_hKey 
: Else 
: To_hKey = To_hKey 
: End If 
: If To_strKeyName = "" Then 
: To_strKeyName = From_strKeyName 
: Else 
: To_strKeyName = To_strKeyName 
: End If 
: 
: Dim mylong As Long 
: mylong = GetRegLong(From_hKey, From_strPath, From_strKeyName) 
: rslt = SaveRegLong(To_hKey, To_strPath, To_strKeyName, mylong) 
: 
: End Function 
: Public Function GetRegSubKeyList(ByVal hKey As RegHive, ByVal strPath As String) 
: On Error Resume Next 
: Dim lResult As Long, lKeyValue As Long, lDataTypeValue As Long, lValueLength As Long 
: Dim sValue As String, td As Double, i As Long, Ret As Boolean, tmprst() 
: Do Until Ret = True 
: lResult = RegOpenKey(hKey, strPath, lKeyValue) 
: sValue = Space$(2048) 
: lValueLength = Len(sValue) 
: lResult = RegEnumKey(lKeyValue, i, sValue, lValueLength) 
: If (lResult = 0) And (Err.Number = 0) Then 
: ReDim Preserve tmprst(i) 
: tmprst(i) = Left$(sValue, InStr(sValue, Chr(0)) - 1) 
: Else 
: Ret = True 
: End If 
: lResult = RegCloseKey(lKeyValue) 
: i = i + 1 
: Loop 
: GetRegSubKeyList = tmprst 
: End Function
: &lt;/pre&gt;&lt;br /&gt;
: Just wack it in a module and it is done&lt;br /&gt;
: from&lt;br /&gt;
: mark&lt;br /&gt;
: &lt;br /&gt;
Thanks mate, but i'll stick to my way :P it seems a bit more easy to me :P&lt;br /&gt;
EtHeO out...&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/evilscripting/253736/254428/re-getting-a-program-to-start-with-windows/#254428</guid>
      <pubDate>Tue, 13 Apr 2004 01:01:16 -0700</pubDate>
      <category>Evil Scripting</category>
    </item>
    <item>
      <title>Re: Getting a program to start with windows</title>
      <link>http://www.programmersheaven.com/mb/evilscripting/253736/303299/re-getting-a-program-to-start-with-windows/#303299</link>
      <description>: : There is another way in a module and the code is this.&lt;br /&gt;
: : &lt;pre class="sourcecode"&gt;
: : Enum RegHive 
: : HKEY_CLASSES_ROOT = &amp;amp;H80000000 
: : HK_CR = &amp;amp;H80000000 
: : HKEY_CURRENT_USER = &amp;amp;H80000001 
: : HK_CU = &amp;amp;H80000001 
: : HKEY_LOCAL_MACHINE = &amp;amp;H80000002 
: : HK_LM = &amp;amp;H80000002 
: : HKEY_USERS = &amp;amp;H80000003 
: : HK_US = &amp;amp;H80000003 
: : HKEY_CURRENT_CONFIG = &amp;amp;H80000005 
: : HK_CC = &amp;amp;H80000005 
: : HKEY_DYN_DATA = &amp;amp;H80000006 
: : HK_DD = &amp;amp;H80000006 
: : End Enum 
: : 
: : Enum RegType 
: : REG_SZ = 1 'Unicode nul terminated string 
: : REG_BINARY = 3 'Free form binary 
: : REG_DWORD = 4 '32-bit number 
: : End Enum 
: : 
: : Public Const ERROR_SUCCESS = 0&amp;amp; 
: : Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long 
: : Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 
: : Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long 
: : Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long 
: : Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 
: : Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long 
: : Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long 
: : Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long 
: : 
: : Public Function DelRegValue(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String) 
: : Dim hCurKey As Long 
: : Dim lRegResult As Long 
: : lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: : lRegResult = RegDeleteValue(hCurKey, strValue) 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : 
: : Public Function DelRegKey(ByVal hKey As RegHive, ByVal strPath As String) As Long 
: : Dim lRegResult As Long 
: : lRegResult = RegDeleteKey(hKey, strPath) 
: : DelRegKey = lRegResult 
: : End Function 
: : 
: : Public Function CreateRegKey(hKey As RegHive, strPath As String) 
: : Dim hCurKey As Long 
: : Dim lRegResult As Long 
: : lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: : If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
: : 'there is a problem 
: : End If 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : Public Function GetRegString(hKey As RegHive, strPath As String, strValue As String, Optional Default As String) As String 
: : Dim hCurKey As Long 
: : Dim lResult As Long 
: : Dim lValueType As Long 
: : Dim strBuffer As String 
: : Dim lDataBufferSize As Long 
: : Dim intZeroPos As Integer 
: : Dim lRegResult As Long 
: : 'Set up default value 
: : If Not IsEmpty(Default) Then 
: : GetRegString = Default 
: : Else 
: : GetRegString = "" 
: : End If 
: : lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: : lRegResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, lValueType, ByVal 0&amp;amp;, lDataBufferSize) 
: : If lRegResult = ERROR_SUCCESS Then 
: : If lValueType = REG_SZ Then 
: : strBuffer = String(lDataBufferSize, " ") 
: : lResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, 0&amp;amp;, ByVal strBuffer, lDataBufferSize) 
: : intZeroPos = InStr(strBuffer, Chr$(0)) 
: : If intZeroPos &amp;gt; 0 Then 
: : GetRegString = Left$(strBuffer, intZeroPos - 1) 
: : Else 
: : GetRegString = strBuffer 
: : End If 
: : End If 
: : Else 
: : 'there is a problem 
: : End If 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : 
: : Public Function SaveRegString(hKey As RegHive, strPath As String, strValue As String, strData As String) 
: : Dim hCurKey As Long 
: : Dim lRegResult As Long 
: : lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: : lRegResult = RegSetValueEx(hCurKey, strValue, 0, REG_SZ, ByVal strData, Len(strData)) 
: : If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
: : 'there is a problem 
: : End If 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : 
: : Public Function GetRegLong(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String, Optional Default As Long) As Long 
: : Dim lRegResult As Long 
: : Dim lValueType As Long 
: : Dim lBuffer As Long 
: : Dim lDataBufferSize As Long 
: : Dim hCurKey As Long 
: : 'Set up default value 
: : If Not IsEmpty(Default) Then 
: : GetRegLong = Default 
: : Else 
: : GetRegLong = 0 
: : End If 
: : lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: : lDataBufferSize = 4 '4 bytes = 32 bits = long 
: : lRegResult = RegQueryValueEx(hCurKey, strValue, 0&amp;amp;, lValueType, lBuffer, lDataBufferSize) 
: : If lRegResult = ERROR_SUCCESS Then 
: : If lValueType = REG_DWORD Then 
: : GetRegLong = lBuffer 
: : End If 
: : Else 
: : 'there is a problem 
: : End If 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : 
: : Public Function SaveRegLong(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValue As String, ByVal lData As Long) 
: : Dim hCurKey As Long 
: : Dim lRegResult As Long 
: : lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: : lRegResult = RegSetValueEx(hCurKey, strValue, 0&amp;amp;, REG_DWORD, lData, 4) 
: : If lRegResult &amp;lt;&amp;gt; ERROR_SUCCESS Then 
: : 'there is a problem 
: : End If 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : 
: : Public Function GetRegByte(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValueName As String, Optional Default As Variant) As Variant 
: : Dim lValueType As Long 
: : Dim byBuffer() As Byte 
: : Dim lDataBufferSize As Long 
: : Dim lRegResult As Long 
: : Dim hCurKey As Long 
: : If Not IsEmpty(Default) Then 
: : If VarType(Default) = vbArray + vbByte Then 
: : GetRegByte = Default 
: : Else 
: : GetRegByte = 0 
: : End If 
: : Else 
: : GetRegByte = 0 
: : End If 
: : lRegResult = RegOpenKey(hKey, strPath, hCurKey) 
: : lRegResult = RegQueryValueEx(hCurKey, strValueName, 0&amp;amp;, lValueType, ByVal 0&amp;amp;, lDataBufferSize) 
: : If lRegResult = ERROR_SUCCESS Then 
: : If lValueType = REG_BINARY Then 
: : ReDim byBuffer(lDataBufferSize - 1) As Byte 
: : lRegResult = RegQueryValueEx(hCurKey, strValueName, 0&amp;amp;, lValueType, byBuffer(0), lDataBufferSize) 
: : GetRegByte = byBuffer 
: : End If 
: : Else 
: : 'there is a problem 
: : End If 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : 
: : Public Function SaveRegByte(ByVal hKey As RegHive, ByVal strPath As String, ByVal strValueName As String, byData() As Byte) 
: : Dim lRegResult As Long 
: : Dim hCurKey As Long 
: : lRegResult = RegCreateKey(hKey, strPath, hCurKey) 
: : lRegResult = RegSetValueEx(hCurKey, strValueName, 0&amp;amp;, REG_BINARY, byData(0), UBound(byData()) + 1) 
: : lRegResult = RegCloseKey(hCurKey) 
: : End Function 
: : 
: : Public Function CopyRegByte(ByVal From_hKey As RegHive, ByVal From_strPath As String, _ 
: : ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
: : Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 
: : 
: : If To_hKey = 0 Then 
: : To_hKey = From_hKey 
: : Else 
: : To_hKey = To_hKey 
: : End If 
: : If To_strKeyName = "" Then 
: : To_strKeyName = From_strKeyName 
: : Else 
: : To_strKeyName = To_strKeyName 
: : End If 
: : 
: : Dim mybytes As Variant 
: : mybytes = GetRegByte(From_hKey, From_strPath, From_strKeyName) 
: : thelen = UBound(mybytes) 
: : Dim x() As Byte 
: : ReDim x(thelen) 
: : For i = 0 To UBound(mybytes) 
: : x(i) = mybytes(i) 
: : Next i 
: : rslt = SaveRegByte(To_hKey, To_strPath, To_strKeyName, x) 
: : End Function 
: : 
: : Public Function CopyRegString(ByVal From_hKey As RegHive, ByVal From_strPath As String, _ 
: : ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
: : Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 
: : 
: : If To_hKey = 0 Then 
: : To_hKey = From_hKey 
: : Else 
: : To_hKey = To_hKey 
: : End If 
: : If To_strKeyName = "" Then 
: : To_strKeyName = From_strKeyName 
: : Else 
: : To_strKeyName = To_strKeyName 
: : End If 
: : 
: : Dim mystring As String 
: : mystring = GetRegString(From_hKey, From_strPath, From_strKeyName) 
: : rslt = SaveRegString(To_hKey, To_strPath, To_strKeyName, mystring) 
: : 
: : End Function 
: : 
: : Public Function CopyRegLong(ByVal hKey As RegHive, ByVal From_strPath As String, _ 
: : ByVal From_strKeyName As String, ByVal To_strPath As String, _ 
: : Optional ByVal To_hKey As RegHive, Optional ByVal To_strKeyName As String) 
: : 
: : If To_hKey = 0 Then 
: : To_hKey = From_hKey 
: : Else 
: : To_hKey = To_hKey 
: : End If 
: : If To_strKeyName = "" Then 
: : To_strKeyName = From_strKeyName 
: : Else 
: : To_strKeyName = To_strKeyName 
: : End If 
: : 
: : Dim mylong As Long 
: : mylong = GetRegLong(From_hKey, From_strPath, From_strKeyName) 
: : rslt = SaveRegLong(To_hKey, To_strPath, To_strKeyName, mylong) 
: : 
: : End Function 
: : Public Function GetRegSubKeyList(ByVal hKey As RegHive, ByVal strPath As String) 
: : On Error Resume Next 
: : Dim lResult As Long, lKeyValue As Long, lDataTypeValue As Long, lValueLength As Long 
: : Dim sValue As String, td As Double, i As Long, Ret As Boolean, tmprst() 
: : Do Until Ret = True 
: : lResult = RegOpenKey(hKey, strPath, lKeyValue) 
: : sValue = Space$(2048) 
: : lValueLength = Len(sValue) 
: : lResult = RegEnumKey(lKeyValue, i, sValue, lValueLength) 
: : If (lResult = 0) And (Err.Number = 0) Then 
: : ReDim Preserve tmprst(i) 
: : tmprst(i) = Left$(sValue, InStr(sValue, Chr(0)) - 1) 
: : Else 
: : Ret = True 
: : End If 
: : lResult = RegCloseKey(lKeyValue) 
: : i = i + 1 
: : Loop 
: : GetRegSubKeyList = tmprst 
: : End Function
: : &lt;/pre&gt;&lt;br /&gt;
: : Just wack it in a module and it is done&lt;br /&gt;
: : from&lt;br /&gt;
: : mark&lt;br /&gt;
: : &lt;br /&gt;
: Thanks mate, but i'll stick to my way :P it seems a bit more easy to me :P&lt;br /&gt;
: EtHeO out...&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
___________________________________&lt;br /&gt;
&lt;br /&gt;
can you tell me in which langauge did you do this code and how to complie it  that all i am new to this sites &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/evilscripting/253736/303299/re-getting-a-program-to-start-with-windows/#303299</guid>
      <pubDate>Fri, 20 May 2005 00:01:21 -0700</pubDate>
      <category>Evil Scripting</category>
    </item>
  </channel>
</rss>