CD-ROM Drive

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

Comments

  • [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. (;->

  • : 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!
  • its damn simple. jus ask me personally:
    emraanelaahi(at.the.rate.of)sify(dot)com


Sign In or Register to comment.

Howdy, Stranger!

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

Categories