Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#38

Re: Übersetzung Class MagneticWindow

  Alt 10. Okt 2006, 20:32
Neuer versuch nächstes Problem

Delphi-Quellcode:
function TMagnetic.zIdx(lng_hWnd: Integer; bAdd: Boolean = False): Integer;
//Get the sc_aSubData() array index of the passed hWnd
//Get the upper bound of sc_aSubData()
//If you get an error here, you're probably Subclass_AddMsg-ing before Subclass_Start

begin
    zIdx := UBound(sc_aSubData);
     While zIdx >= 0 Do //Iterate through the existing sc_aSubData() elements
        With sc_aSubData[zIdx] do
        begin
            If (hwnd = lng_hWnd) Then //If the hWnd of this element is the one we're looking for
            begin
              If (Not bAdd) Then //If we're searching not adding
                Exit; //Found
              If (hwnd = 0) Then //If this an element marked for reuse.
              begin
                If (bAdd) Then //If we're adding
                    Exit;
              end;
            End;
        End;
        dec(zIdx); //Decrement the index

End;
Zitat:
zIdx := UBound(sc_aSubData);

UBound kennt Delphi nicht.
UBound-Funktion liefert den größten Index vom Array(sc_aSubData) zurück.
Wie kann ich unter Delphi den größten Index in einem Array ermitteln ?
Erledigt: zIdx := High(sc_aSubData);

Ebenso funktioniert diese abfrage nicht 'While zIdx >= 0 Do' Fehler meldung

Zitat:
[Pascal Error] Magnetic.pas(782): E2035 Not enough actual parameters
Warum muss hier noch das lng_hWnd als Parameter übergeben werden ?

Das scheint zu funktionieren zIdx := zIdx(lng_hWnd) - 1; aber irgendwie unlogisch.

gruß
  Mit Zitat antworten Zitat