Hello All :)
I have problem when i get startupmenu location path to combine with Application EXE Name.
here the complete code:
problem is here:
because sDest always give startUpPath location "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\"
should be "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\myapp.exe"
but, when i do manually, this is work:
but this is not what i want, i want to use this way :
sDest = S & "\" & App.EXEName & ".EXE"
Anyone know to solve my problem..
thank you
I have problem when i get startupmenu location path to combine with Application EXE Name.
here the complete code:
Code:
Declare Function SHGetSpecialFolderLocation Lib "shell32" (ByVal hwnd As Long, ByVal nFolder As Long, Pidl As Long) As Long
Declare Function SHGetPathFromIDList Lib "shell32" (Pidl As Long, ByVal FolderPath As String) As Long
Const CSIDL_COMMON_STARTUP = 24
Const MAX_PATH = 260
Public Function StartupMenu() As String
Dim lpStartupPath As String * MAX_PATH
Dim Pidl As Long
Dim hResult As Long
hResult = SHGetSpecialFolderLocation(0, CSIDL_COMMON_STARTUP, Pidl)
If hResult = 0 Then
hResult = SHGetPathFromIDList(ByVal Pidl, lpStartupPath)
If hResult = 1 Then
lpStartupPath = Left(lpStartupPath, InStr(lpStartupPath, Chr(0)) - 1)
StartupMenu = lpStartupPath
End If
End If
End Function
Private Sub Form_Load()
S = StartupMenu
sDest = S & "\" & App.EXEName & ".EXE"
End Sub
Code:
sDest = S & "\" & App.EXEName & ".EXE"
should be "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\myapp.exe"
but, when i do manually, this is work:
Code:
S = "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\" & App.EXEName & ".EXE"
sDest = S & "\" & App.EXEName & ".EXE"
Anyone know to solve my problem..
thank you