Autor Beitrag
Metrik
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80

Win XP, Win Vista
C# (VS 2003, #Develop)
BeitragVerfasst: So 31.12.06 19:24 
Hallo

Gibt es eine Klasse in C#, mit der man ein CDRom Laufwerk öffnen, beziehungsweise schliessen kann?
(Bei mehreren Laufwerken sollte man genau bestimmen, können welches geöffnet wird.)

Und wenn möglich sollte das ganze ohne dllimport gehen( nur wenn möglich =D ).

Wenn einer ne Idee oder einen Tipp für mich hat, bitte posten.

Danke im Vorraus
Metrik


Moderiert von user profile iconUGrohne: Topic aus IO, XML und Registry verschoben am Mo 01.01.2007 um 17:20
Smikey
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 45

Win XP, kUbuntu 6.06
Delphi 2005 Architect
BeitragVerfasst: So 31.12.06 21:00 
google.

"c# laufwerk öffnen"

;D

mfg smikey

_________________
Bloß weil du nicht paranoid bist, heißt das nicht, dass sie nicht hinter dir her sind.
Metrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80

Win XP, Win Vista
C# (VS 2003, #Develop)
BeitragVerfasst: So 31.12.06 22:11 
Hallo
Erst mal danke für den Google-Tip
Habe es jetzt geschaft, dass sich mein Laufwerk öffnet *freu*

Aber, wenn ich 2 habe, öffnet sich nur eines :(

Habe noch gegoogelt, aber nichts gefunden, das mir weiterhilft oder das ich verstehe :D

Wenn mir wer helfen kann, soll der das bitte tun.

Metrik
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 01.01.07 18:19 
Wie hast Du es denn angestellt, dann kann man Dir vielleicht weiterhelfen.
Metrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80

Win XP, Win Vista
C# (VS 2003, #Develop)
BeitragVerfasst: Mo 01.01.07 20:44 
Hallo

ausblenden volle Höhe C#-Quelltext
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:
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Microsoft.Win32;

namespace CDOpen
{
    class Program
    {

        static void Main(string[] args)
        {
            CommandLineImput();
        }
        public static void CommandLineImput()
        {
            string InPut = string.Empty;

            Console.Write("> ");
            InPut = Console.ReadLine();

            switch (InPut.ToLower())
            {
                case "":
                    break;
                case "open":
                    api.mciSendString(@"set CDAudio door open"null2560);
                    CommandLineImput();
                    break;
                case "close":
                    api.mciSendString("set CDAudio door closed"null1270);
                    CommandLineImput();
                    break;
                default:
                    Console.WriteLine("Error: \"{0}\" ist falsch...!", InPut);
                    CommandLineImput();
                    break;
            }
        }

        public class api
        {
            // this api uesed to send string messege to media control interface decice (mci)
            // like The cd rom
            [DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
            public static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
        }
    }
}


Hier hab ich mal das schon erreichte gepostet. Wenn ihr noch Verbesserungsvorschäge oder Anmerkungen habt, einfach posten ^^

Problem ist immer noch: Wie kann ich mehrere Laufwerke öffnen ?

Metrik