home *** CD-ROM | disk | FTP | other *** search
- unit Main;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: CDMUSICC }
-
- { Example of how to call a C DLL from Delphi.
- The code in the C DLL very closely parallels
- the code in the Delphi PLAYER program.
-
- You need a CD player, and a music CD in the
- player, to run this program. However, even if
- you don't have a CD, you can tell that you are
- calling the DLL correctly by seeing if you get
- a proper error message when you hit "Play CD".
- For instance, if you get a message that says
- 'Calling Func' or 'Return Code', then that's the DLL
- talking to you. See the ErrorMsg routine in
- CDINFO.CPP }
-
- interface
-
- uses
- WinTypes, WinProcs, Classes,
- Graphics, Forms, Controls,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- bOpenCD: TButton;
- bCloseCD: TButton;
- bPlayCD: TButton;
- procedure bOpenCDClick(Sender: TObject);
- procedure bPlayCDClick(Sender: TObject);
- procedure bCloseCDClick(Sender: TObject);
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- uses
- CDUnitC;
-
- {$R *.DFM}
-
- procedure TForm1.bOpenCDClick(Sender: TObject);
- begin
- if OpenCD(Handle) then begin
- bPlayCD.Enabled := True;
- bCloseCD.Enabled := True;
- end;
- end;
-
- procedure TForm1.bPlayCDClick(Sender: TObject);
- begin
- PlayCDOneTrack(1);
- end;
-
- procedure TForm1.bCloseCDClick(Sender: TObject);
- begin
- CloseCDMCI;
- end;
-
- end.
-
-