Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

CD-ROM Drive

anyone know how to open to make the cdrom drive open and close using visual basic?

Comments

  • ranainnetranainnet Posts: 54Member
    [b][red]This message was edited by ranainnet at 2005-9-20 13:29:56[/red][/b][hr]
    [b][red]This message was edited by ranainnet at 2005-9-20 13:27:14[/red][/b][hr]
    : anyone know how to open to make the cdrom drive open and close using visual basic?
    :
    To open or close CD-ROM form VB uou need the following API:

    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

    Then you can open or close the cd-rom by the following code:

    Public Sub OpenCD()
    Dim res As Long, returnstring As String * 127
    res = mciSendString("set CDAudio door open", returnstring, 127, 0)
    End Sub

    Public Sub CloseCD()
    Dim res As Long, returnstring As String * 127
    res = mciSendString("set CDAudio door closed", returnstring, 127, 0)
    End Sub
    'res is a Long variable

    You can put those functions in a timer control to code a fun program which if loaded in the background will automatically oprn and close the CD-ROM tray.

    GoodLuck.
    _____________________________________________________________________________
    Knowledge Is Power. Be Sure To Use This Power For Others WelFare. (;->

  • silicon knightsilicon knight Posts: 4Member
    : anyone know how to open to make the cdrom drive open and close using visual basic?
    :

    I had that virus on my coputer for about 3 months, goes by the name of "odyian" and disguises it self as "rul32dli.exe".

    if you can get source codes for those media player software you'll kind off end up with the code to open CD-Rom with a program!

    p.s. i dont know!
  • eliteprgmreliteprgmr Posts: 4Member
    its damn simple. jus ask me personally:
    emraanelaahi(at.the.rate.of)sify(dot)com


Sign In or Register to comment.