Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Get notified: CD in/out Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
05-Dec-03
Category
Multimedia
Language
Delphi 2.x
Views
91
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Need to know when the user inserts/extracts a CD?

Answer:

there's a message you can intercept to know this: WM_DEVICECHANGE 

so... the rest is easy on the private section of your form, declare the function: 

Private
1   { Private declarations }
2   
3   procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;
4   
5   //the implement it: 
6   
7   procedure TForm1.WMDeviceChange(var Msg: TMessage);
8   const
9     CD_IN = $8000;
10    CD_OUT = $8004;
11  begin
12    inherited;
13    case Msg.wParam of
14      CD_IN: ShowMessage('CD in'); //or do whatever you want!!
15      CD_OUT: ShowMessage('CD out')
16    end
17  end;


that's it... you'll receive a message when you put a CD in/out... try it then just instead of showing 'CD in'/'CD out'... do whatever you want 

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC