Hiiii, I'm going explain a simple program which will enable u to control ur CD ; I mean "Opening and Closing ur CD" without a touch. you'll do this from your VB program.
So let's begin;;;;;;;;;
First make a form with simply 2 commands one called Open CD and the other called Close CD "I can't put imagesright now because I have only 6 posts"
The code should be:
well this is the explanation:Code:Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Public retValue As Long Private Sub Command1_Click() retValue = mciSendString("Set CDAudio door open", 0, 0, 0) End Sub Private Sub Command2_Click() retValue = mciSendString("Set CDAudio door Closed", 0, 0, 0) End Sub
First I declared a function "An API function" called mciSendString >>> If u don't know what is API plz get out of the topicI'm joking ;
well API stands for Application Programming Interface and they are a group of compiled functions in a special type of files called dll files so u can include them to perform certain functions so in my example the function is mciSendString and the dll file which contains the function is winmm.dll and i included the function in my program by using the word Declare Function
I think that u got the idea of API if u need more explanation about API dont't hesitate just tell me
now to the second part of the code which iswell i made a variable of the type "Long" to receive the output of the API function and i made it public so that all subroutines will be able to recognize it....Code:Public retValue As Long
In this line of code I entered parameters to the API function and then received the output which will be long value in the variable retValueCode:retValue = mciSendString("Set CDAudio door open", 0, 0, 0)
the same as before but i changed the first parameter so that i can close the CD......Code:retValue = mciSendString("Set CDAudio door Closed", 0, 0, 0)
I hope u enjoyed the lesson.....
this is me Zizooooo
Good bye
interesting tutorial. Thanks +rep!
Thanks for reply >>>>>
works great.
thanks for the tut!![]()
nice work +rep
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks