Dear Galuh,
Coba code ini :
Buat 1 module yang isinya sbb :
'===== Module Begin ====='
Attribute VB_Name = "MdlCD"
Option Explicit
Public 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 Function OpenCDDoor(ByVal drv As String) As Long
Dim Alias As String
Dim retval As Long
Alias = "Drive" & drv
retval = -1
retval = mciSendString("open " & drv & ": type cdaudio alias " & Alias & "
wait", vbNullString, 0&, 0&)
retval = mciSendString("set " & Alias & " door open", vbNullString, 0&, 0&)
OpenCDDoor = retval
End Function
Public Function CloseCDDoor(ByVal drv As String) As Long
Dim Alias As String
Dim retval As Long
Alias = "Drive" & drv
retval = -1
retval = mciSendString("set " & Alias & " door closed", vbNullString, 0&, 0&)
retval = mciSendString("close " & Alias, vbNullString, 0&, 0&)
CloseCDDoor = retval
End Function
'===== End Module ====='
Dan untuk memanggilnya jalankan syntax berikut :
OpenCDDoor Left("E:", 1) 'untuk membuka cd drive ( ganti sesuai drive CD atau
gunakan combodrive )
CloseCDDoor Left("E:", 1) 'untuk menutup cd drive ( ganti sesuai drive CD atau
gunakan combodrive )
Semoga membantu
Best Regards,
Dhani Aristyawan, S. Kom.
IT Supervisor
PT. ALP Petro Industry
Desa Kebonsari - Legok
Pasuruan - 67155
Phone : +62 343 853308 Ext. 62
FAX : +62 343 853307
Visit me @ http://dasmaniacool.blogspot.com<http://dasmaniacool.blogspot.com/>
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of galuh
adi insani
Sent: Thursday, October 04, 2007 11:54 PM
To: indoprog
Subject: [indoprog-vb] Buka tutup CD ROM
Dear vbers
Teman-teman saya pernah memiliki sebuah script VB yang didalamnya
berfungsi untuk membuka dan menutup CD ROM jika kita klik aplikasi
tersebut, tetapi sayangnya script tersebut hilang. Diantara teman-teman
indoprog apakah ada yang memiliki script tersebut, dan mohon share ke
saya. Terimakasih
________________________________
PT. ALP PETRO INDUSTRY - Electronic Mail DISCLAIMER
The information contained in this communication (including any attachments) is
privileged and confidential, and may be legally exempt from disclosure under
applicable law. It is intended only for the specific purpose of being used by
the individual or entity to whom it is addressed. If you are not the addressee
indicated in this message (or are responsible for delivery of the message to
such person), you must not disclose, disseminate, distribute, deliver, copy,
circulate, rely on or use any of the information contained in this transmission.
We apologize if you have received this communication in error; kindly inform
the sender accordingly. Please also ensure that this original message and any
record of it is permanently deleted from your computer system. We do not give
or endorse any opinions, conclusions and other information in this message that
do not relate to our official business.
________________________________
PT. ALP PETRO INDUSTRY - Electronic Mail DISCLAIMER
The information contained in this communication (including any attachments) is
privileged and confidential, and may be legally exempt from disclosure under
applicable law. It is intended only for the specific purpose of being used by
the individual or entity to whom it is addressed. If you are not the addressee
indicated in this message (or are responsible for delivery of the message to
such person), you must not disclose, disseminate, distribute, deliver, copy,
circulate, rely on or use any of the information contained in this transmission.
We apologize if you have received this communication in error; kindly inform
the sender accordingly. Please also ensure that this original message and any
record of it is permanently deleted from your computer system. We do not give
or endorse any opinions, conclusions and other information in this message that
do not relate to our official business.
[Non-text portions of this message have been removed]