Autor Beitrag
dddd
Hält's aus hier
Beiträge: 15



BeitragVerfasst: So 15.02.04 14:02 
Hallo, hab wieder ne Frage.

Ich will über eine Combo Box verschiedene Befehle auswählen können.
Beispiel:

user defined image


da wo DVD DRIVE steht müssen wenn ich draufklick folgende laufweke stehn: D,E,F,G

wenn ich z.B. d anklicke und auf dvd kopieren gehe, muss er die cd, die in laufwerk d drinen is, kopieren.

wäre dankbar für hilfe

Moderiert von user profile iconPeter Lustig: Topic verschoben
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: So 15.02.04 14:12 
hast du überhaupt schon einen source code zum Kopieren von DVDs???
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: So 15.02.04 14:27 
*kopfkratz*

legal??

_________________
Delphi: XE - OS: Windows 7 Professional x64
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 15.02.04 14:29 
Jupp. Er fragt ja nicht, wie er eine DVD rippen kann, sondern wie er eine ComboBox benutzt.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: So 15.02.04 14:38 
Es gibt doch bei Win 3.1 die Komponente DriveComboBox
Benedikt
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 15.02.04 15:46 
Die Laufwerke kannst du wie folgt ausgeben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  Drive:        Char;
begin
        for Drive := 'A' to 'Z' do
        begin
                case GetDriveType(PChar(Drive + ':/')) of
                        DRIVE_FIXED:            comboBox.Items.Add(Drive+':\');
                end;
        end;
end;


Welche Konstante du dann allerdings für DVD/CD-Rom brauchst, musst selber mal gucken.
dddd Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: So 15.02.04 18:47 
was muss ich bei dem befehl dann verändern ?

bin noch recht neu auf diesem gebiet.

kann daher nur standart.

ps: für die kopierfunktion is schon alles drin
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Di 17.02.04 14:01 
ja würde auch gerne wissen wie das gemacht wird.
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 17.02.04 19:25 
Tja, es ist schon anstrengend, einfach mal Suche in: Delphi-Forum, Delphi-Library GETDRIVETYPE in die Suchfunktion einzutippen und beispielsweise mal einen Blick auf den einzigen gefundenen Beitrag aus der FAQ-Sparte zu werfen.
sauerkraut
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70



BeitragVerfasst: Di 17.02.04 19:56 
hmmm du hast keine ahnung vom proggen, willst aber nen dvd ripper schreiben? löl :D :shock:
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Di 17.02.04 20:02 
was hat das eine mit dem andere zu tun???? :?
dddd Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Do 19.02.04 10:47 
sauerkraut hat folgendes geschrieben:
hmmm du hast keine ahnung vom proggen, willst aber nen dvd ripper schreiben? löl :D :shock:


dafür braucht man keine Kenntnisse im Proggen.

das geht über eine einfache *.BAT !


Ich werde das ma jetzt versuchen mit der combo box, danke
dddd Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Do 19.02.04 10:54 
der zeigt mir immer "var" in rot und kann nicht compiln.

Hier is mal der vollständige Code:

ausblenden volle Höhe Delphi-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:
52:
53:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, shellapi;

type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    procedure ComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
function CopyDir(const fromDir, toDir: string): Boolean;
var
  fos: TSHFileOpStruct;
begin
  ZeroMemory(@fos, SizeOf(fos));
  with fos do
begin
  wFunc  := FO_COPY;
//  fFlags := FOF_FILESONLY;
  pFrom  := PChar(fromDir + #0);
  pTo    := PChar(toDir + #0)
end;
  Result := (0 = ShFileOperation(fos));
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
var
  Drive:        Char;
begin
        for Drive := 'D' to 'C' do
        begin
                case GetDriveType(PChar(Drive + ':/')) of 
                        DRIVE_FIXED:            comboBox.Items.Add(Drive+':\');
                end; 
        end;
end;
end;

end.



was stimmt da nicht ?
Benedikt
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 19.02.04 15:06 
dddd hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
var
  Drive:        Char;
begin
        for Drive := 'D' to 'C' do
        begin
                case GetDriveType(PChar(Drive + ':/')) of 
                        DRIVE_FIXED:            comboBox.Items.Add(Drive+':\');
                end; 
        end;
end;
end;

end.



Das ist fehlerhaft, weil über dem Var noch ein Begin steht - das muss da weg.
Außerdem bis du dir sicher, da du bei jedem OnChange von der ComboBox die Laufwerke unten dranhängen willst?
Ich würd die nur einmal beim FormCreate eintragen.
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 19.02.04 17:25 
also ich hab das mal auch so eingegeen hab auch das begin vor dem var weggemacht
bei mir gab er das an:

ausblenden Delphi-Quelltext
1:
DRIVE_FIXED:            comboBox.Items.Add					

was soll ich da machen??

Kannst du mal den source geben, wo alles drinne ist??
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: So 22.02.04 22:03 
Kann bitte jemand helfen?? :roll:
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: So 22.02.04 22:37 
oben wurde doch alles beschrieben...
du musst halt bedenken, dass der Zeilenumbruch ein paar Zeilen verschiebt....


....
ausblenden Delphi-Quelltext
1:
2:
3:
case GetDriveType(PChar(Drive + ':/')) of  
  DRIVE_FIXED:  comboBox.Items.Add(Drive+':\'); 
end;

....

_________________
Delphi: XE - OS: Windows 7 Professional x64
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Di 24.02.04 15:03 
also ich hab nochmal alles versucht aber nix geht. immer zeigt er dies hiert rot an:
ausblenden Delphi-Quelltext
1:
DRIVE_FIXED:    comboBox.Items.Add(Drive+':\');					
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 24.02.04 16:29 
Versprichst du, Bücher zu lesen und die Suchfunktion zu benutzen, bis dir der Delphi-Quellcode zu den Ohren rauskommt? Ja? Okay, dann werde ich mal nicht so sein:
ausblenden volle Höhe Delphi-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:
procedure TForm1.Button1Click(Sender: TObject);
var
  dwBufLen : dword;
  buf      : string;
  p        : pchar;
begin
  ComboBox1.Items.Clear;

  dwBufLen := GetLogicalDriveStrings(0,nil);
  if(dwBufLen > 0) then
  begin
    SetLength(buf,dwBufLen);

    if(GetLogicalDriveStrings(dwBufLen,@buf[1]) <> 0) and
      (buf <> '') then
    begin
      p      := @buf[1];
      while(p[0] <> #0) do
      begin
        case GetDriveType(p) of
          DRIVE_FIXED:
            ComboBox1.Items.Add(Format('Festplatte %s',[p]));
          DRIVE_REMOVABLE:
            ComboBox1.Items.Add(Format('Wechsellaufwerk %s',[p]));
          DRIVE_REMOTE:
            ComboBox1.Items.Add(Format('Netzlaufwerk %s',[p]));
          DRIVE_CDROM:
            ComboBox1.Items.Add(Format('CD/DVD-Laufwerk %s',[p]));
          DRIVE_RAMDISK:
            ComboBox1.Items.Add(Format('RAM-Disk %s',[p]));
        end;

        inc(p,lstrlen(p)+1);
      end;

      buf := '';
    end;
  end;
end;

Eins noch: Denk vor dem Ausprobieren bitte darüber nach, ob es besonders sinnvoll wäre, diesen Code in das "OnChange"-Ereignis der Combobox einzutragen?
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Di 24.02.04 17:08 
Ja ich hab ja schon ein buch hier liegen aber da steht nix drüber drinne. So ich hab jetzt hier mal mein kompletten source:

ausblenden volle Höhe Delphi-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:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    ComboBox1: TComboBoxEx;
    procedure ComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ComboBox1Change(Sender: TObject);

var
  dwBufLen : dword;
  buf      : string; 
  p        : pchar;
begin
  ComboBox1.Items.Clear; 

  dwBufLen := GetLogicalDriveStrings(0,nil); 
  if(dwBufLen > 0) then 
  begin
    SetLength(buf,dwBufLen); 

    if(GetLogicalDriveStrings(dwBufLen,@buf[1]) <> 0) and 
      (buf <> '') then 
    begin
      p      := @buf[1]; 
      while(p[0] <> #0) do 
      begin 
        case GetDriveType(p) of
          DRIVE_FIXED: 
            ComboBox1.Items.Add(Format('Festplatte %s',[p])); 
          DRIVE_REMOVABLE:
            ComboBox1.Items.Add(Format('Wechsellaufwerk %s',[p])); 
          DRIVE_REMOTE: 
            ComboBox1.Items.Add(Format('Netzlaufwerk %s',[p]));
          DRIVE_CDROM: 
            ComboBox1.Items.Add(Format('CD/DVD-Laufwerk %s',[p]));
          DRIVE_RAMDISK: 
            ComboBox1.Items.Add(Format('RAM-Disk %s',[p]));
        end;

        inc(p,lstrlen(p)+1);
      end;

      buf := ''; 
    end;
  end;
end;


jetzt sagt er das er es nicht compilen kann. Mir ist es auch schon peinlich zu fragen :oops: