CODE
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace CD
{
public partial class Form1 : Form
{
[DllImport(@"C:\.....\DLL\CDTRAY\CDTRAY.DLL")]
private static extern void Eject();
[DllImport(@"C:\....\DLL\CDTRAY\CDTRAY.DLL")]
private static extern void Play();
[DllImport(@"C:\...\DLL\CDTRAY\CDTRAY.DLL")]
private static extern void Stop();
.....
.....
private void button1_Click(object sender, EventArgs e)
{
Eject();
}
private void button2_Click(object sender, EventArgs e)
{
Play();
}
....
.....
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace CD
{
public partial class Form1 : Form
{
[DllImport(@"C:\.....\DLL\CDTRAY\CDTRAY.DLL")]
private static extern void Eject();
[DllImport(@"C:\....\DLL\CDTRAY\CDTRAY.DLL")]
private static extern void Play();
[DllImport(@"C:\...\DLL\CDTRAY\CDTRAY.DLL")]
private static extern void Stop();
.....
.....
private void button1_Click(object sender, EventArgs e)
{
Eject();
}
private void button2_Click(object sender, EventArgs e)
{
Play();
}
....
.....
How do we do it in .NET? Is there any easier way? Currently I am building a DLL using another language to be referenced from .NET program.
BTW, every time I close the program, the CD would stopped playing, even I did not click Stop button.