![]() |
Vereinfachen oder Verkürzen
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:
Es funktioniert zwar soweit ist aber dann doch ein bisschen umständlich.
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; |
Re: Vereinfachen oder Verkürzen
Hi!
Warum nicht einfach so?
Delphi-Quellcode:
if CB1.Checked then
ShellExecute(Handle, nil, PChar(f1), nil, nil, SW_SHOW); if CB2.Checked then ShellExecute(Handle, nil, PChar(f2), nil, nil, SW_SHOW); if CB3.Checked then ShellExecute(Handle, nil, PChar(f3), nil, nil, SW_SHOW); Ciao Frederic |
Re: Vereinfachen oder Verkürzen
Das ist eine gute frage, ich wusste das ich irgendwas falsch gemacht hatte, bei meinen ganzen versuchen vorher.
:wall: Aber wieso leicht wenns auch schwer geht *sich selbst verprügeln könnt* Thx @fkerber |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:18 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz