#include <stdio.h> #include <stdlib.h> #include <windows.h> #include "rc.h" int main() { JOYINFOEX Joypad_Info; // pour avoir les eta des button de la joysrick Joypad_Info.dwFlags = JOY_RETURNALL; DWORD dwBoutons; // pour garder la dernier action faite int delai; system("title conaitre le ctrl d'une touche d'un joystique"); printf("tester un joystique\n"); printf("delai: "); scanf("%d", &delai); /* debugage du joystique */ switch(joyGetPosEx(JOYSTICKID1,&Joypad_Info)) { case MMSYSERR_NODRIVER: MessageBox(NULL, TEXT("le joystique n'est pas present.\n"), TEXT("4"), MB_OK); break; case MMSYSERR_INVALPARAM: MessageBox(NULL, TEXT("un paramètre non valide a ete passe..\n"), TEXT("4"), MB_OK); break; case MMSYSERR_BADDEVICEID: MessageBox(NULL, TEXT("l'identifiant joystick spécifié n'est pas valide.\n"), TEXT("4"), MB_OK); break; case JOYERR_UNPLUGGED: MessageBox(NULL, TEXT("le joystick specifie n'est pas connecte auBUTACTUAL systeme.\n"), TEXT("4"), MB_OK); break; case JOYERR_PARMS: MessageBox(NULL, TEXT("l'identifiant joystick specifie n'est pas valide.\n"), TEXT("4"), MB_OK); break; default: // MessageBox(NULL, TEXT("le joystique est pret a l'emploi.\n"), TEXT("4"), MB_OK); break; } while(1) { Sleep(delai); joyGetPosEx(JOYSTICKID1,&Joypad_Info); if(Joypad_Info.dwButtons != NULL) { printf("__ ctrl : %d __", Joypad_Info.dwButtons); printf("\n"); } /* Quand on appui sur start on ferme le prog */ if(Joypad_Info.dwButtons != 512) { break; } } return 0; } Par contre j'ai un probleme au niveau de la simulations des touches, quand chu sur cs sa fais buguer !
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include <stdio.h> #include <stdlib.h> #include <windows.h> #include "rc.h" int main() { JOYINFOEX Joypad_Info; // pour avoir les eta des button de la joysrick Joypad_Info.dwFlags = JOY_RETURNALL; DWORD dwBoutons; // pour garder la dernier action faite int delai; system("title conaitre le ctrl d'une touche d'un joystique"); printf("tester un joystique\n"); printf("delai: "); scanf("%d", &delai); /* debugage du joystique */ switch(joyGetPosEx(JOYSTICKID1,&Joypad_Info)) { case MMSYSERR_NODRIVER: MessageBox(NULL, TEXT("le joystique n'est pas present.\n"), TEXT("4"), MB_OK); break; case MMSYSERR_INVALPARAM: MessageBox(NULL, TEXT("un paramètre non valide a ete passe..\n"), TEXT("4"), MB_OK); break; case MMSYSERR_BADDEVICEID: MessageBox(NULL, TEXT("l'identifiant joystick spécifié n'est pas valide.\n"), TEXT("4"), MB_OK); break; case JOYERR_UNPLUGGED: MessageBox(NULL, TEXT("le joystick specifie n'est pas connecte auBUTACTUAL systeme.\n"), TEXT("4"), MB_OK); break; case JOYERR_PARMS: MessageBox(NULL, TEXT("l'identifiant joystick specifie n'est pas valide.\n"), TEXT("4"), MB_OK); break; default: // MessageBox(NULL, TEXT("le joystique est pret a l'emploi.\n"), TEXT("4"), MB_OK); break; } while(1) { Sleep(delai); joyGetPosEx(JOYSTICKID1,&Joypad_Info); if(Joypad_Info.dwButtons != NULL) { printf("__ ctrl : %d __", Joypad_Info.dwButtons); printf("\n"); } /* Quand on appui sur start on ferme le prog */ if(Joypad_Info.dwButtons != 512) { break; } } return 0; }