Me gustaria saber si me podrias decir si hay algun comando que actue de la misma forma que el comando Start de MS-DOS, es decir que me permita abrir un archivo com el programa por defecto Tambien podria valerme si me dijerais como ejecutar programas en MS-DOS utilizando VB. Utilizo el comando Shell, Shell ("Command.com") pero a continuacion no se como ejecutar en MS-DOS los comandos.
Con la función shell ejecutas un archivo que se abrirá con el programa que este vinculado a la extensión como tú bien has dicho. A continuación te pongo el código necesario para enviar los comandos al ms-dos. Espero que te sea util. Salu2. pegalo en el form Private mvarDestination As Long 'local copy Private Const KEYEVENTF_EXTENDEDKEY = &H1 Private Const KEYEVENTF_KEYUP = &H2 Private Const VK_SHIFT = &H10 Private Declare Function OemKeyScan Lib "user32" (ByVal wsOemchar As Integer) As Long Private Declare Function CharToOem Lib "user32" Alias "CharToOemA" (ByVal lpszSrc _ As String, ByVal lpszDst As String) As Long Private Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal cChar As _ Byte) As Integer Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal _ wCode As Long, ByVal wMapType As Long) As Long Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _ ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Sub SendAKey(ByVal sKeys As String) Dim vk As Integer Dim nShiftScan As Integer Dim nScan As Integer Dim sOemchar As String Dim nShiftKey As Integer vk = VkKeyScan(Asc(sKeys)) And &HFF ' Mira si el boton Shift necesita ser presionado nShiftKey = VkKeyScan(Asc(sKeys)) And 256 sOemchar = " " ' 2 character buffer CharToOem Left$(sKeys, 1), sOemchar nScan = OemKeyScan(Asc(sOemchar)) And &HFF ' *** Envia la tecla pulsada If nShiftKey = 256 Then ' Si la tecla Shift necesita ser pulsada nShiftScan = MapVirtualKey(VK_SHIFT, 0) ' *** Presiona la tecla Shift keybd_event VK_SHIFT, nShiftScan, 0, 0 End If ' *** Presiona la tecla que sera enviada keybd_event vk, nScan, 0, 0 If nShiftKey = 256 Then keybd_event VK_SHIFT, nShiftScan, KEYEVENTF_KEYUP, 0 End If keybd_event vk, nScan, KEYEVENTF_KEYUP, 0 End Sub Public Sub SendKeys(ByVal sKeys As String) Dim X As Integer For X = 1 To Len(sKeys) AppActivate (mvarDestination) SendAKey Mid$(sKeys, X, 1) Next End Sub Public Property Let Destination(ByVal vData As Long) mvarDestination = vData End Property Public Property Get Destination() As Long Destination = mvarDestination End Property