[c#] utilisation de mcisendcommand
Bonsoir,
Dans ma recherche de l'utilisation de la commande mcisendcommand, j'ai trouvé au lien ci dessous une transcription en c# de toutes les commandes de winmm.dll
http://www.koders.com/csharp/fidD708...mcisendcommand
sur cette base j'ai construis ce programme dont l'objectif est d'ouvrir un cd audio pour lire dans un deuxième temps les informations relatives aux pistes
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;
using HANDLE = System.IntPtr;
using HWND = System.IntPtr;
using HDC = System.IntPtr;
namespace essai_winmm
{
public partial class Form1 : Form
{
public struct MCI_OPEN_PARMS
{
public int dwCallback;
public int wDeviceID;
public string lpstrDeviceType;
public string lpstrElementName;
public string lpstrAlias;
}
public struct MCI_STATUS_PARMS
{
public int dwCallback;
public int dwReturn;
public int dwItem;
public short dwTrack;
}
public struct MCI_INFO_PARMS
{
public int dwCallback;
public string lpstrReturn;
public int dwRetSize;
}
public const int MCI_OPEN = 0x803;
public const int MCI_OPEN_ALIAS = 0x400;
public const int MCI_OPEN_ELEMENT = 0x200;
public const int MCI_OPEN_ELEMENT_ID = 0x800;
public const int MCI_OPEN_SHAREABLE = 0x100;
public const int MCI_OPEN_TYPE = 0x2000;
public const int MCI_OPEN_TYPE_ID = 0x1000;
[DllImport("winmm")]
public static extern int mciSendCommand(int wDeviceID, int uMessage, int dwParam1, IntPtr dwParam2);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MCI_OPEN_PARMS mciOpenParms = new MCI_OPEN_PARMS();
mciOpenParms.lpstrDeviceType = "cdaudio";
mciOpenParms.lpstrElementName = "E";
int Score = mciSendCommand(0, MCI_OPEN, (MCI_OPEN_TYPE | MCI_OPEN_ELEMENT), mciOpenParms);
}
}
} |
Mon problème est que j'ai un message m'informant que le dernier argument de ma commande mcisendcommand n'est pas correcte
Comment faire pour faire fonctionner en utilisant le type IntPrt
par avance merci