vb安装打包的疑问
用vb自带的打包程序打包,如何制作那种可以设置开机后自动启动的安装程序
[解决办法]
这个是要自己写的,开机自启的代码我好像有...............
代码楼主参考一下:
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As LongPrivate 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 ' Note that if you declare the lpData parameter as String, you must pass it By Value.Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As LongPrivate Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPrivate Const HKEY_LOCAL_MACHINE = &H80000002Private Const REG_SZ = 1Private Const KEY_SET_VALUE = &H2Dim h, m, s As IntegerDim x As StringPrivate Sub Command1_Click() Dim sKeyName As String Dim sKeyValue As String Dim iRet As Long Dim hKey As Long sKeyName = "abc" sKeyValue = App.Path & IIf(Len(App.Path), "\" & App.EXEName & ".exe", App.EXEName & ".exe") Select Case Check1.Value Case 1 iRet = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", hKey) iRet = RegSetValueEx(hKey, sKeyName, 0&, REG_SZ, ByVal sKeyValue, Len(sKeyValue) * 2) iRet = RegCloseKey(hKey) Case 0 iRet = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", hKey) iRet = RegDeleteValue(hKey, sKeyName) iRet = RegCloseKey(hKey) End Select