[c] ouvrir lecteur cd
Résolu
mx321
Messages postés
3
Date d'inscription
Statut
Membre
Dernière intervention
-
mehdihdr -
mehdihdr -
Bonjour,
Je programme en language C et j'ai cherché sur le web un code source pour ouvrir le lecteur cd avec un code C mais je n'ai rien trouvé.
OS: Windows XP
Si quelqu'un pouvait m'aider merci beaucoup.
Je programme en language C et j'ai cherché sur le web un code source pour ouvrir le lecteur cd avec un code C mais je n'ai rien trouvé.
OS: Windows XP
Si quelqu'un pouvait m'aider merci beaucoup.
A voir également:
- [c] ouvrir lecteur cd
- Comment ouvrir un fichier epub ? - Guide
- Ouvrir fichier .bin - Guide
- Ouvrir fichier .dat - Guide
- Comment ouvrir un fichier docx ? - Guide
- Ouvrir avec - Guide
4 réponses
Vous avez quel compilateur mx321 ?
Car si vous avez DEV-C++ ce code devrait fonctionner :
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
typedef MCIERROR (WINAPI* joMciSendString) ( LPCTSTR lpszCommand,
LPTSTR lpszReturnString,
UINT cchReturn,
HANDLE hwndCallback );
int main()
{
HMODULE hDll = LoadLibrary("winmm.dll");
if(!hDll)
{
printf("Erreur LoadLibrary\n");
system("pause");
return 0;
}
joMciSendString MyFunc = (joMciSendString)GetProcAddress(hDll, "mciSendStringA");
if(!MyFunc)
{
printf("Erreur GetProcAddress\n");
FreeLibrary(hDll);
system("pause");
return 0;
}
MyFunc("Set cdaudio door open wait", NULL, 0, NULL);
FreeLibrary(hDll);
return 0;
}
----------------------------------------------------------------------------------------------------
Si vous voulez le refermer, dans la ligne
MyFunc("Set cdaudio door open wait", NULL, 0, NULL);
remplacez open par closed
J'espere que je ne suis pas trop tard et que ce code va fonctionner chez vous
Au revoir
DjGab
Car si vous avez DEV-C++ ce code devrait fonctionner :
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
typedef MCIERROR (WINAPI* joMciSendString) ( LPCTSTR lpszCommand,
LPTSTR lpszReturnString,
UINT cchReturn,
HANDLE hwndCallback );
int main()
{
HMODULE hDll = LoadLibrary("winmm.dll");
if(!hDll)
{
printf("Erreur LoadLibrary\n");
system("pause");
return 0;
}
joMciSendString MyFunc = (joMciSendString)GetProcAddress(hDll, "mciSendStringA");
if(!MyFunc)
{
printf("Erreur GetProcAddress\n");
FreeLibrary(hDll);
system("pause");
return 0;
}
MyFunc("Set cdaudio door open wait", NULL, 0, NULL);
FreeLibrary(hDll);
return 0;
}
----------------------------------------------------------------------------------------------------
Si vous voulez le refermer, dans la ligne
MyFunc("Set cdaudio door open wait", NULL, 0, NULL);
remplacez open par closed
J'espere que je ne suis pas trop tard et que ce code va fonctionner chez vous
Au revoir
DjGab
ca marche 5/5 avec dev C++