Trucos Distribuir ADO (2.x) con el Setup Wizard del VB 5

De la KB de Microsoft

SUMARIO
La redistribución de ADO, RDS y otros componentes de acceso a datos de Microsoft con el Asistente para instalar aplicaciones del Visual Basic 5 debe hacerse ejecutando el MDAC_TYP.exe.

Puedes obtener la última version de dicho fichero en http://www.microsoft.com/data/download.htm

MAS INFORMACION
Este artículo asume que tienes ADO ya instalado en tu ordenador.

El archivo MDAC_TYP.exe contiene sólo los fichero binarios necesarios para redistribuir los componentes, no contiene documentación. Puedes llamar a este ejecutable en el evento QueryUnload del Setup1.frm.

Debemos tener en cuenta que además del MDAC_TYP.exe, necesitas distribuir DCOM95 para los clientes Windows 95. DCOM debe estar instalado antes de instalar MDAC. Windows 2000, NT 4.0 y 98 ya incluyen el DCOM. Puedes obtener la última versión del DCOM95 en
http://www.microsoft.com/com
DCOM debe ser instalado separada y anteriormente al MDAC_TYP.exe y que no puede ser instalado con el programa de instalación de tu aplicación.

La instalación de MDAC puede necesitar reiniciar el sistema, dependiendo de lo que estuviera cargado en momoria antes de comenzar dicha instalación. Por eso usaremos el comando Shell para ejecutar la instalación. De esta manera permitimos que Setup1 y Setup finalicen adecuadamente.

Seguiremos los siguientes pasos (podemos ignorar tranquilamente los avisos sobre la falta del archivo de dependencias para ADODB) :

- Hacer una copia del directorio ..VB\Setupkit\Setup1

- Abrir el fichero Setup1.vbp de dicho directorio

- Añadir el siguiente código y comentarios en el evento QueryUnload del formulario frmSetup1.frm :

      'Variable used to string path and EXE together.
      Dim progname As String
      'Global gstrDestDir As String 'dest dir for application files
      'gstrDestDir is defined earlier in basSetup1.bas
      'Uncommenting the line below hides the file on the user's machine.
      'This may be desired if it will be left on the user's machine after
      'the install. Note, the application's Uninstall routine will remove
      'this file, though.

       SetAttr gstrDestDir & "MDAC_TYP.exe", vbHidden

      'All the calls below invoke MDAC Setup in a Quiet mode, meaning no
      'choices or options for the user to select or choose, "Setup.exe /Q".

      'The first two methods provide a minimum of a standard setup
      'background and thermometer bar window showing the progress of the
      'install. The first install methods are the most user-friendly.

      'When setup is called with "/Q0" it exits with a Message box
      'notifying the user it completed successfully. It also tells the
      'user if it is necessary to reboot the system to complete the
      'installation and gives the choice to reboot now or later.

      SetAttr gstrDestDir & "MDAC_TYP.exe", vbHidden


      'Setup called with "/Q1" is the same as "/Q0" but exits without any
      'notification to the user that it installed successfully. It also
      'does not provide any notification that it is about to reboot the
      'system - if necessary.

      'progname = gstrDestDir & "mdacrdst.exe /q /c:" & Chr(34) & _
                  "setup.exe /Q1" & Chr(34) & ""

      'When called with "/QT", almost everything is hidden and almost zero
      'feedback is given to the user that an install is occurring or when
      'it is finished. This method is probably the least favorable.

      'progname = gstrDestDir & "mdac_typ.exe /q /c:" & Chr(34) & _
                     "setup.exe /QT" & Chr(34) & ""

      'Spawns the MDAC installation.
      Shell progname, vbNormalFocus


- Grabar el proyecto y compilar de nuevo el Setup1.exe

- Arrancar el Asistente para instalar aplicaciones y seleccionar el proyecto deseado.

- En el paso "Componentes ActiveX Server" aparecerá chequeado Msado15.dll. Desmarcarlo.

- En el Resumen de Ficheros, añadir el fichero MDAC_TYP.exe si elegiste el método de distribución "Unidad de discos" o "Directorios de discos". Si optaste por "Directorio único" puede ser mejor no añadir el fichero. En este caso el mdacrdst.exe se ejecuta desde el directorio de instalación y no se copia al directorio de instalación de la aplicación. Esto es útil para distribuciones en CD o instalaciones en red donde no queremos tener una copia del MDAC_TYP.exe en la máquina cliente.

- En el paso final, grabamos la plantilla y generamos la distribución.



Trucos Trucos

Visual Basic Página de Visual Basic

Página principal Página principal

www.jrubi.com