Click here to Skip to main content
15,898,538 members
Home / Discussions / C#
   

C#

 
GeneralRe: ZeroMemory Pin
Rodney S. Foley3-Sep-02 2:13
Rodney S. Foley3-Sep-02 2:13 
GeneralRe: ZeroMemory Pin
Nnamdi Onyeyiri3-Sep-02 7:46
Nnamdi Onyeyiri3-Sep-02 7:46 
GeneralRe: ZeroMemory Pin
leppie3-Sep-02 2:28
leppie3-Sep-02 2:28 
GeneralRe: ZeroMemory Pin
Nnamdi Onyeyiri3-Sep-02 7:48
Nnamdi Onyeyiri3-Sep-02 7:48 
GeneralRe: ZeroMemory Pin
Nnamdi Onyeyiri3-Sep-02 8:02
Nnamdi Onyeyiri3-Sep-02 8:02 
GeneralRe: ZeroMemory Pin
leppie3-Sep-02 9:51
leppie3-Sep-02 9:51 
GeneralRe: ZeroMemory Pin
Nnamdi Onyeyiri3-Sep-02 9:55
Nnamdi Onyeyiri3-Sep-02 9:55 
GeneralCDR solution Pin
leppie3-Sep-02 10:34
leppie3-Sep-02 10:34 
Hi , it was a bit trickey, but using int's did the job Smile | :)

[DllImport("winmm.dll" , CharSet = CharSet.Ansi)]
static extern int mciSendCommand(int device, int msg, int flags, int param);

const int MCI_OPEN = 0x0803;
const int MCI_DEVTYPE_CD_AUDIO = 516;
const int MCI_SET                         = 0x080D;
const int MCI_SET_DOOR_OPEN              = 0x00000100;
const int MCI_SET_DOOR_CLOSED            = 0x00000200;

[StructLayout(LayoutKind.Sequential)]
public class MCI_OPEN_PARMS
{
	public int    dwCallback; 
	public int  wDeviceID;
	public int       lpstrDeviceType;
	public int       lpstrElementName; 
	public int       lpstrAlias; 
}

[Flags]
public enum MCIOPEN
{
	SHAREABLE             = 0x00000100,
	ELEMENT               = 0x00000200,
	ALIAS                 = 0x00000400,
	ELEMENT_ID            = 0x00000800,
	TYPE_ID               = 0x00001000,
	TYPE                  = 0x00002000,
}


and the implementation Smile | :)

MCIOPEN flags;

flags = MCIOPEN.TYPE | MCIOPEN.TYPE_ID | MCIOPEN.SHAREABLE;

MCI_OPEN_PARMS param = new MCI_OPEN_PARMS();
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(param));
param.lpstrDeviceType = MCI_DEVTYPE_CD_AUDIO;

Marshal.StructureToPtr(param, ptr,  true);
int result = mciSendCommand(0, MCI_OPEN, (int) flags, ptr.ToInt32()); //get the ID
Marshal.PtrToStructure(ptr, param);
Marshal.FreeHGlobal(ptr);

result = mciSendCommand(param.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0); //open drive
result = mciSendCommand(param.wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, 0); //close drive


OK, I didnt bother with drive numbers Blush | :O

MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc
for more info. Big Grin | :-D
GeneralRe: CDR solution Pin
Nnamdi Onyeyiri3-Sep-02 21:54
Nnamdi Onyeyiri3-Sep-02 21:54 
GeneralRe: CDR solution Pin
leppie3-Sep-02 22:56
leppie3-Sep-02 22:56 
GeneralRe: ZeroMemory Pin
Rüpel3-Sep-02 2:48
Rüpel3-Sep-02 2:48 
GeneralRe: ZeroMemory Pin
Paul Riley3-Sep-02 3:32
Paul Riley3-Sep-02 3:32 
GeneralRe: ZeroMemory Pin
Nick Parker4-Sep-02 9:12
protectorNick Parker4-Sep-02 9:12 
Generalaccess memory within unmanaged dll Pin
Rüpel2-Sep-02 23:45
Rüpel2-Sep-02 23:45 
GeneralRe: access memory within unmanaged dll Pin
Rüpel2-Sep-02 23:55
Rüpel2-Sep-02 23:55 
GeneralRe: access memory within unmanaged dll Pin
Stephane Rodriguez.3-Sep-02 0:06
Stephane Rodriguez.3-Sep-02 0:06 
GeneralRe: access memory within unmanaged dll Pin
Rüpel3-Sep-02 0:38
Rüpel3-Sep-02 0:38 
GeneralRe: access memory within unmanaged dll Pin
leppie3-Sep-02 1:42
leppie3-Sep-02 1:42 
GeneralRe: access memory within unmanaged dll Pin
Rüpel3-Sep-02 2:39
Rüpel3-Sep-02 2:39 
GeneralRe: access memory within unmanaged dll Pin
leppie3-Sep-02 3:27
leppie3-Sep-02 3:27 
GeneralDoing programs Pin
suresh_sathya2-Sep-02 23:39
suresh_sathya2-Sep-02 23:39 
GeneralRe: Doing programs Pin
Stephane Rodriguez.2-Sep-02 23:54
Stephane Rodriguez.2-Sep-02 23:54 
QuestionHow can be only one ? Pin
candan2-Sep-02 16:42
professionalcandan2-Sep-02 16:42 
AnswerRe: How can be only one ? Pin
Stephane Rodriguez.3-Sep-02 0:11
Stephane Rodriguez.3-Sep-02 0:11 
AnswerRe: How can be only one ? Pin
Christian Graus3-Sep-02 0:46
protectorChristian Graus3-Sep-02 0:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.