473,396 Members | 2,020 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,396 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 4033
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.