Jump to content

Control ur CD without a touch

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Zizooooo

Zizooooo

    Newbie

  • Members
  • PipPip
  • 15 posts
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:
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

well this is the explanation:
First I declared a function "An API function" called mciSendString >>> If u don't know what is API plz get out of the topic :) I'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 is
Public retValue As Long
well 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....
retValue = mciSendString("Set CDAudio door open", 0, 0, 0)
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 retValue
retValue = mciSendString("Set CDAudio door Closed", 0, 0, 0)
the same as before but i changed the first parameter so that i can close the CD......
I hope u enjoyed the lesson.....
this is me Zizooooo
Good bye


#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
interesting tutorial. Thanks +rep!

#3
Zizooooo

Zizooooo

    Newbie

  • Members
  • PipPip
  • 15 posts
Thanks for reply >>>>>

#4
sk8rjess

sk8rjess

    Newbie

  • Members
  • Pip
  • 4 posts
works great.
thanks for the tut! :)

#5
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
nice work +rep