Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/11/2008, 17:09
Avatar de aldo1982
aldo1982
 
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 6 meses
Puntos: 6
De acuerdo Respuesta: Ejecutar aplicación al iniciar windows e incluirla en la barra de tareas.

buenas dos puntos:

para que se ejecute al inicio

creas un modulo bas con este codigo

Código:
''''''''''
'Registry Related API's and Functions


'''The RegOpenKeyEx function opens the specified key.
Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long

'''The RegCloseKey function releases a handle to the specified key.
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal _
  hKey As Long) As Long
  

''''The RegSetValueEx function sets the data and type of a specified value under a registry key.
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 Const HKEY_CURRENT_USER = &H80000001
Public Const KEY_WRITE = &H20006
Public Const REG_SZ = 1

y en el load del formulario inicial este codigo...dos puntos


Código:
Dim hregkey As Long
Dim subkey As String
Dim stringbuffer As String

' Write to Registry.
subkey = "Software\Microsoft\Windows\CurrentVersion\Run"

RetVal = RegOpenKeyEx(HKEY_CURRENT_USER, subkey, 0, _
  KEY_WRITE, hregkey)
If RetVal <> 0 Then
   Debug.Print "Can't open the subkey"
  Exit Sub
End If
stringbuffer = App.Path & "\" & App.EXEName & ".exe" & vbNullChar
RetVal = RegSetValueEx(hregkey, "MyApp", 0, REG_SZ, _
  ByVal stringbuffer, Len(stringbuffer))

RegCloseKey hregkey
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA