Einzelnen Beitrag anzeigen

Benutzerbild von Durg
Durg

Registriert seit: 19. Sep 2004
Ort: Essen
13 Beiträge
 
Delphi 7 Enterprise
 
#1

Vereinfachen oder Verkürzen

  Alt 7. Nov 2004, 16:04
Also ich bin mir ziemlich sicher, das man diesen Code Vereinfach und/oder Verkürzen kann, da mir atm nichts vernünftiges einfällt und ich sowieso noch nicht soviel Erfahrung mit Delphi hab auch wenn ich mich schon einige Zeit damit beschäftige, aber es gibt ja noch anderes
Hier der Code:

Delphi-Quellcode:
if (CB1.Checked) and (CB2.Checked) and (CB3.Checked)
    then
      begin
        ShellExecute(Handle, nil, PChar(f1), nil, nil, SW_SHOW);
        ShellExecute(Handle, nil, PChar(f2), nil, nil, SW_SHOW);
        ShellExecute(Handle, nil, PChar(f3), nil, nil, SW_SHOW);
      end
  else if (CB1.Checked) and (CB2.Checked)
    then
      begin
        ShellExecute(Handle, nil, PChar(f1), nil, nil, SW_SHOW);
        ShellExecute(Handle, nil, PChar(f2), nil, nil, SW_SHOW);
      end
  else if (CB1.Checked) and (CB3.Checked)
    then
      begin
        ShellExecute(Handle, nil, PChar(f1), nil, nil, SW_SHOW);
        ShellExecute(Handle, nil, PChar(f3), nil, nil, SW_SHOW);
      end
  else if (CB2.Checked) and (CB3.Checked)
    then
      begin
        ShellExecute(Handle, nil, PChar(f2), nil, nil, SW_SHOW);
        ShellExecute(Handle, nil, PChar(f3), nil, nil, SW_SHOW);
      end
  else if CB1.Checked
    then
      ShellExecute(Handle, nil, PChar(f1), nil, nil, SW_SHOW)
  else if CB2.Checked
    then
      ShellExecute(Handle, nil, PChar(f2), nil, nil, SW_SHOW)
  else if CB3.Checked
    then
      ShellExecute(Handle, nil, PChar(f3), nil, nil, SW_SHOW)
  else
   exit;
Es funktioniert zwar soweit ist aber dann doch ein bisschen umständlich.
-->>Das große kleine Delphi beginner<<--
  Mit Zitat antworten Zitat