| 
	
		|  Autor | Tema: Detectar atajos de teclado  (Leído 10,557 veces) |  
	| 
			| 
					
						| seba123neo | 
 
cada registrada de combinaciones tiene un ID, es el segundo parametro, vos ahi estas registrando todas con el mismo ID = 1 , y cuando repetis los ID, solo te toma la ultima ...debes hacer algo como:
 If RegisterHotKey(hWnd, 1, MOD_CONTROL Or MOD_ALT, VK_1) = 0 Then
 ...codigo...
 If RegisterHotKey(hWnd, 2, MOD_CONTROL Or MOD_ALT, VK_1) = 0 Then
 codigo...
 If RegisterHotKey(hWnd, 3, MOD_CONTROL Or MOD_ALT, VK_1) = 0 Then
 codigo....
 
 y en el NewWindowProc el parametro wParam, te va a llegar con el ID de la combinacion que apretaste, y bueno ahi haces un if o un select case y listo...
 
 PD: para desregistrar tambien debes hacerlo con el ID...
 
 saludos.
 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| 50l3r 
								 
								
								 Desconectado 
								Mensajes: 784
								
								 
								Solo se que se algo pero no me acuerdo
								
								
								
								
								
								     | 
 
ok gracias sea123neo, ahora si lo entendi 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| 50l3r 
								 
								
								 Desconectado 
								Mensajes: 784
								
								 
								Solo se que se algo pero no me acuerdo
								
								
								
								
								
								     | 
 
esto en el form load:     If RegisterHotKey(hWnd, 1, MOD_CONTROL Or MOD_ALT, VK_1) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If    If RegisterHotKey(hWnd, 2, MOD_CONTROL Or MOD_ALT, VK_2) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If    If RegisterHotKey(hWnd, 3, MOD_CONTROL Or MOD_ALT, VK_3) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If    If RegisterHotKey(hWnd, 4, MOD_CONTROL Or MOD_ALT, VK_4) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If    If RegisterHotKey(hWnd, 5, MOD_CONTROL Or MOD_ALT, VK_5) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If    If RegisterHotKey(hWnd, 6, MOD_CONTROL Or MOD_ALT, VK_6) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If    If RegisterHotKey(hWnd, 7, MOD_CONTROL Or MOD_ALT, VK_7) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If    If RegisterHotKey(hWnd, 8, MOD_CONTROL Or MOD_ALT, VK_8) = 0 Then    MsgBox " Hubo un error ", vbCritical    Exit Sub    End If     WinProc = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf NewWindowProc)
 esto en el modulo: Public Function NewWindowProc( _                ByVal hWnd As Long, _                ByVal Msg As Long, _                ByVal wParam As Long, _                ByVal lParam As Long) As Long     If Msg = &H82 Then        Call SetWindowLong(hWnd, GWL_WNDPROC, WinProc)       Call UnregisterHotKey(hWnd, 1)     End If if wparam = 1 then msgbox "apretaste 1"if wparam = 2 then msgbox "apretaste 2"if wparam = 3 then msgbox "apretaste 3"if wparam = 4 then msgbox "apretaste 4"if wparam = 5 then msgbox "apretaste 5"if wparam = 6 then msgbox "apretaste 6"if wparam = 7 then msgbox "apretaste 7"if wparam = 8 then msgbox "apretaste 8"      NewWindowProc = CallWindowProc(WinProc, hWnd, Msg, wParam, lParam) End Function  
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  | 
			| 
					
						| 50l3r 
								 
								
								 Desconectado 
								Mensajes: 784
								
								 
								Solo se que se algo pero no me acuerdo
								
								
								
								
								
								     | 
 
solo lo puse para ver si funcionaba, no funciona
 al iniciar el proyecto se crea un bucle que dice" apretaste1"
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| raul338 
								       
								
								 Desconectado 
								Mensajes: 2.633
								
								 
								La sonrisa es la mejor forma de afrontar las cosas
								
								
								
								
								
								     | 
 
es porque no pussite flitro. o sea, todos esos IF tenes que meterlos dentro de un if que valide si Msg es WM_HOTKEY Public Function NewWindowProc( _                ByVal hWnd As Long, _                ByVal Msg As Long, _                ByVal wParam As Long, _                ByVal lParam As Long) As Long     If Msg = &H82 Then        Call SetWindowLong(hWnd, GWL_WNDPROC, WinProc)       Call UnregisterHotKey(hWnd, 1)     End If if Msg = WM_HOTKEY Then ' Creo que es &H83 si mi memoria no me falla :Pif wparam = 1 then msgbox "apretaste 1"if wparam = 2 then msgbox "apretaste 2"if wparam = 3 then msgbox "apretaste 3"if wparam = 4 then msgbox "apretaste 4"if wparam = 5 then msgbox "apretaste 5"if wparam = 6 then msgbox "apretaste 6"if wparam = 7 then msgbox "apretaste 7"if wparam = 8 then msgbox "apretaste 8" end If     NewWindowProc = CallWindowProc(WinProc, hWnd, Msg, wParam, lParam) End Function  PD: La proxima sere un poco mas claro para que me entiendas mejor :P (x la explicacion de antes :xD)
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | Atajos teclado, Trucos y Versiones de Android Android
 | el-brujo | 5 | 28,643 |  24 Abril 2014, 12:05 pm por JazMalta
 |  
						|   |   | Conoce los atajos de teclado de Windows 8 Noticias
 | wolfbcn | 0 | 3,061 |  13 Marzo 2012, 19:00 pm por wolfbcn
 |  
						|   |   | Toastify, crea atajos de teclado para Spotify en Windows Noticias
 | wolfbcn | 0 | 2,562 |  10 Febrero 2013, 21:45 pm por wolfbcn
 |  
						|   |   | Si tienes un Mac, memoriza estos 13 atajos del teclado Noticias
 | wolfbcn | 0 | 1,931 |  22 Abril 2014, 18:54 pm por wolfbcn
 |  
						|   |   | 19 sitios web para aprender los atajos de teclado de tus sistemas y programas... Noticias
 | wolfbcn | 0 | 1,590 |  31 Marzo 2016, 15:00 pm por wolfbcn
 |    |