Come si fa' a far aprire lo sportellino del CD in C ???
(Se e' possibile vorrei saperlo sia per Win che per Linux)
Come si fa' a far aprire lo sportellino del CD in C ???
(Se e' possibile vorrei saperlo sia per Win che per Linux)
PoWered by:
Gentoo 1.5.3 - Kernel 2.6.7
Debian Sid - Kernel 2.6.7 - Bash 3.0
Slackware current - Kernel 2.6.7
Per aprire il cassettino del lettore devi usare la api mciSendString in questo modo:
Ricordati però che devi dire al compilatore di importare anche la libreria winmm.lib pero non con l'include...codice:#include<stdio.h> #include<windows.h> int ris=0; char yo[100]; main() { ris=mciSendString("set CDAudio door open",yo,100,0); }
Io con visual C faccio così.
Vai su Project-->Settings..
Nella Tab clicca su Link, e nella casella di testo vicino alla scritta Object/Libraries modules, inserisci in fondo winmm.lib
A questo punto compila pure e il cassettino ti si apre...
Se vuoi chiudere il cassettino basta che invece di "set CDAudio door open" gli metti "set CDAudio door closed"..
Ciao ciao
"Penso che nel mondo ci sia mercato per quattro o cinque computer"... Thomas Watson, presidente della IBM, 1943
E funziona con tutti i lettori CD ???
PoWered by:
Gentoo 1.5.3 - Kernel 2.6.7
Debian Sid - Kernel 2.6.7 - Bash 3.0
Slackware current - Kernel 2.6.7
Io Non ho nessuna libreria "winmm.lib"
non me la trova... Neanche a fare "cerca" !!!!
PoWered by:
Gentoo 1.5.3 - Kernel 2.6.7
Debian Sid - Kernel 2.6.7 - Bash 3.0
Slackware current - Kernel 2.6.7
dicci almeno che compilatore C utilizzi :quipy:
con Dev C++ la libreria da includere è : libwinmm.a
la trovi nella directory \LIB\ del compilatore.
Per includerla al "Progetto": menù Progetto\Opzioni del progetto\Parametri\Linker\ (aggiungi libreria o oggetti)
...Terrible warlords, good warlords, and an english song
Scusa Johnny hai ragione...
cmq uso Dev C++
Grazie Mille della Risposta..
PoWered by:
Gentoo 1.5.3 - Kernel 2.6.7
Debian Sid - Kernel 2.6.7 - Bash 3.0
Slackware current - Kernel 2.6.7
per linux:
sostituisci il device che vuoi usarecodice:#include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <linux/cdrom.h> main() { int fd=open("/dev/hdd",O_RDONLY | O_NONBLOCK); ioctl(fd,CDROMEJECT); close(fd); }
Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.
Grazie...
PoWered by:
Gentoo 1.5.3 - Kernel 2.6.7
Debian Sid - Kernel 2.6.7 - Bash 3.0
Slackware current - Kernel 2.6.7
Asso che storia...
In teoria dovrebbe funzionare anche sotto linux?
"Penso che nel mondo ci sia mercato per quattro o cinque computer"... Thomas Watson, presidente della IBM, 1943
:master: quale?Originariamente inviato da I'mtheleader
Asso che storia...
In teoria dovrebbe funzionare anche sotto linux?
quello che ho postato io è per linux.
Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.