vb装配打包的疑问
vb安装打包的疑问
用vb自带的打包程序打包,如何制作那种可以设置开机后自动启动的安装程序
------解决方案--------------------
这个是要自己写的,开机自启的代码我好像有...............
代码楼主参考一下:
用vb自带的打包程序打包,如何制作那种可以设置开机后自动启动的安装程序
------解决方案--------------------
这个是要自己写的,开机自启的代码我好像有...............
代码楼主参考一下:
- VB code
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private 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 Long Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Const HKEY_LOCAL_MACHINE = &H80000002 Private Const REG_SZ = 1 Private Const KEY_SET_VALUE = &H2 Dim h, m, s As Integer Dim x As String Private 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