opening cd-rom remotely

hello, i have a snippet of code here that i will show you, it simply allows a user to click a button to open the CD Drawer and another button to close, however i have been asked if i could get this feature to work across a network, but as networks are the abyss to me i would apreciate any hints or help that could be provided.
thanks alot in advance
John Wesley

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


Private Sub cmdOpen_Click()
Dim lngReturn As Long
Dim strReturn As Long
lngReturn = mciSendString("set CDAudio door open", strReturn, 127, 0)
End Sub

Private Sub cmdClose_Click()
Dim lngReturn As Long
Dim strReturn As Long
lngReturn = mciSendString("set CDAudio door closed", strReturn, 127, 0)
End Sub

Comments

  • Hello there. I think the best way to do this would be to use the Microsoft Winsock Control provided with Visual Basic. (You can include this control in your toolbox by going to Projects|Components and selecting Microsoft Winsock Control 6.0 from the list). This is a wonderful control for building client server applications on VB. You'll have to get some tutorials on using this control (http://www.vbip.com could be a good place). After building a simple client server application, you could execute your CD drawer opening code by including the execution code in the Winsock_DataArrival event of Winsock (in the server part of your application). When the client sends some command to open the CD drawer, like, "OpenCD", the server would execute the code and open the CD drawer.

    Hope that helps,
    Ashish

    : hello, i have a snippet of code here that i will show you, it simply allows a user to click a button to open the CD Drawer and another button to close, however i have been asked if i could get this feature to work across a network, but as networks are the abyss to me i would apreciate any hints or help that could be provided.
    : thanks alot in advance
    : John Wesley
    :
    : 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
    :
    :
    : Private Sub cmdOpen_Click()
    : Dim lngReturn As Long
    : Dim strReturn As Long
    : lngReturn = mciSendString("set CDAudio door open", strReturn, 127, 0)
    : End Sub
    :
    : Private Sub cmdClose_Click()
    : Dim lngReturn As Long
    : Dim strReturn As Long
    : lngReturn = mciSendString("set CDAudio door closed", strReturn, 127, 0)
    : End Sub
    :
    :
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

In this Discussion