Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/05/2005, 03:34
aigama
 
Fecha de Ingreso: julio-2003
Ubicación: Donostia-San Sebastián
Mensajes: 129
Antigüedad: 20 años, 10 meses
Puntos: 0
De acuerdo

En mi proyecto hay un único formulario, y lo que quiero es poder moverme por los programas que tengo en ejecución en el sistema, no en mi propio proyecto. Pero ya he conseguido solucionarlo, gracias por tu ayuda de todas formas.

Lo he solucionado utilizando el API keybd_event de la siguiente forma:
With the first sentence the menu I want to see doesn't appear, and the form is executing minimizate.
With the second sentence the menu appeared for only a few seconds and one of the programms are running is oppened.

Option Explicit

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2
Const VK_TAB = &H9
Const VK_MENU = &H12

Private Sub Command1_Click()
keybd_event VK_MENU, 0, 0, 0
keybd_event VK_TAB, 0, 0, 0
End Sub

Private Sub Command2_Click()
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
End Sub

Con el botón Command1 abriré el menú, y con el botón Command2 me moveré por el menún para excoger el programa que quiero. (Una vez que haya excogido el programa que me interesa se ejecutará la siguiente sentencia:

keybd_event VK_MENU,0,KEYEVENTF_KEYUP,0