473,432 Members | 1,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,432 developers and data experts.

Opening and Closing CD TRAY

Ali Rizwan
925 512MB
Hi all,

Here is a simple used to Open and Close CD TRAY.
Comment it PLEASE!


Expand|Select|Wrap|Line Numbers
  1. 'add this lines of code in the declaration section of a standard module.
  2.  '---------------
  3. Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
  4. (ByVal lpszCommand As String, ByVal lpszReturnString As String, _
  5. ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long
  6. '--------------
  7.  
  8. 'Now in the module also declare this
  9. '-----------------------------------
  10.  Sub opencd()
  11.      Call mciSendString("set CDAudio door open", 0, 0, 0)
  12.     End Sub
  13.  
  14. Sub closecd()
  15.    Call mciSendString("set CDAudio door closed", 0, 0, 0)
  16.     End Sub
  17. '-----------------------------------
  18. 'Now add two command buttons to the form ( its obvious what i have taken below)
  19. '-----------------------------------
  20. Private Sub Command1_Click()
  21. Call Module1.opencd
  22. End Sub
  23.  
  24. Private Sub Command2_Click()
  25. Call Module1.closecd
  26. End Sub
  27. '----------------------------------
Regards
>> ALI <<
Feb 25 '08 #1
2 4036
If your want here it is. COMMONT: good code. I use in some of my programs
Mar 22 '08 #2
Very useful and very good
Mar 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jean-Fran?ois Lacrampe | last post by:
Hello, I want to write a _very_ simple text parser that would replace a string like: "This is text with /italics/, *bold* and _underline_." and generate automatically something like this: ...
1
by: MJEASSOC | last post by:
I need some help with closing a popup window. I'm making an online portfolio, that has one base page with text and thumbnails. When a user clicks on a thumb, a new window opens containing a larger...
3
by: Greg | last post by:
On my report I want to have an opening balance signifying all transactions up to the month selected and detailed transactions for the month selected and then a closing blance. I'm perpelexed...
8
by: Mickey Swanson | last post by:
Is there any way to determing why a form is closing? As in if the user cliced the x button or if a system shutdown has started. thanks for any help Mickey Swanson
2
by: Du Dang | last post by:
I tried to implement a feature like msn or yahoo messeger, where the user click the "x" button, the form just hide itself to the tray icon. I got it to work by added the following code to the...
5
by: Matthew | last post by:
I would like to make it so when a user clicks the X in the upper right corner it hides the form instead of closing it. I have an icon in the system tray, and other forms running. If the main form...
7
by: Martien van Wanrooij | last post by:
I have been faced a couple of times with the situation that I wanted to write a script and was worried about a too frequent opening and closing mysql connections. To give some examples: 1)I...
3
by: Paul H | last post by:
I have a transactions table and a balance table that look something like this: tblTransactions TransactionID (PK Autonumber) ClientID TransactionDate TransactionAmount (currency field, values...
2
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
I am (still) relatively new to Windows applications, most of my experience has been Web based, and I am confused about what exactly happens when the Main() method is called and how to manipulate...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.