Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Neue Variable -> CPU-Fenster kommt (https://www.delphipraxis.net/37383-neue-variable-cpu-fenster-kommt.html)

Die Muhkuh 5. Jan 2005 10:25


Neue Variable -> CPU-Fenster kommt
 
Moin,

ich habe im private Abschnitt eine neue Variable eingefügt:

Delphi-Quellcode:
private
    { Private-Deklarationen }
    FEnemyAdventPos: Integer;
    FFrame: Integer;
    FMusik: array[0..1] of string;
    FPlayer1: Boolean; //<<-- Da, da, da!
Seit dem kommt bei jedem Start das CPU-Fenster. Kommentiere ich die Variable aus, kommt das CPU-Fenster nicht.

So, jetzt gehts aber noch weiter. Kommentiere ich irendeine Variable von da oben aus, kommt das CPU-Fenster auch nicht.

Ich kann mir das absolut nicht erklären.

Hier ist noch ein Bild vom CPU-Fenster.

Sprint 5. Jan 2005 10:43

Re: Neue Variable -> CPU-Fenster kommt
 
Zitat:

Zitat von Spider
Ich kann mir das absolut nicht erklären.

Kurze Frage: Windows 2000 ohne aktuellem Service Pack?

Die Muhkuh 5. Jan 2005 10:53

Re: Neue Variable -> CPU-Fenster kommt
 
Nein. WinXP mit SP1.

Christian Seehase 5. Jan 2005 11:55

Re: Neue Variable -> CPU-Fenster kommt
 
Moin Spider,

und was steht im OnCreate des Formulares?
Ich vermute mal, dass da irgendwo etwas überschrieben wird.

Die Muhkuh 5. Jan 2005 12:03

Re: Neue Variable -> CPU-Fenster kommt
 
Moin Chris,

Delphi-Quellcode:
procedure Tfmain.FormCreate(Sender: TObject);
begin
  Randomize;
  SetVariables;

{$IFDEF debug}
{$ELSE}
  FMusik[0] := ExtractFilePath(Application.ExeName) + 'Musik1.mid';
  FMusik[1] := ExtractFilePath(Application.ExeName) + 'Musik2.mid';

  mpPlayer1.FileName := FMusik[0];
  mpPlayer1.Open;

  mpPlayer2.FileName := FMusik[1];
  mpPlayer2.Open;
  mpPlayer2.Play;
  FPlayer1 := false;
{$ENDIF}
end;
Delphi-Quellcode:
procedure Tfmain.SetVariables;
begin
  ExePath := ExtractFilePath(Application.ExeName);

  Engine := SpriteEngine.Engine;
  Draw := DXDraw;
  Images := ImageList;
  InputStates := Input.States;

  FEnemyAdventPos := 0;
  FFrame := 0;
  FAnzahl := 0;
  FCounter := 0;
  FOldCounter := 0;
  FScore := 0;
  FGoodieCounter := 0;
  FOldGoodieCounter := 0;
  FPointCounter := 0;
  FOldPointCounter := 0;
  FBaustelleCounter := 0;
  FOldBaustelleCounter := 0;

  if Debug = 2 then
    DebugSL := TStringList.Create;
end;

Christian Seehase 5. Jan 2005 12:21

Re: Neue Variable -> CPU-Fenster kommt
 
Moin Manu,

die Zeilen mit denen ich nichts anfangen kann:

Delphi-Quellcode:
  Engine := SpriteEngine.Engine;
  InputStates := Input.States;
wenn vor der Anzeige des Formulares, sonst nichts passiert erscheinen mir diese als "verdächtig", zumal ich nicht weiss, was jeweils dahintersteckt. ;-)

Die Muhkuh 5. Jan 2005 12:27

Re: Neue Variable -> CPU-Fenster kommt
 
Moin Chris,

das sind von den DelphiX Komponenten einmal die SpriteEngine und einmal die ein DXInput zum überprüfen welche Tasten gedrückt werden. Mit denen hat das nichts zu tun.

Christian Seehase 5. Jan 2005 12:37

Re: Neue Variable -> CPU-Fenster kommt
 
Moin Manu,

dann starte das Programm doch mal mit F7/F8, und versuch' mal den Fehler im Einzelschrittmodus einzukreisen.

mirage228 5. Jan 2005 12:38

Re: Neue Variable -> CPU-Fenster kommt
 
Hi,

hast Du mal versucht, das ganze Schrittweise auszuführen, um herauszufinden, wo der Fehler genau auftritt? ;)

mfG
mirage228

Edit: Mist, zu spät :P

Die Muhkuh 5. Jan 2005 12:43

Re: Neue Variable -> CPU-Fenster kommt
 
So,

ich habs mal einkreisen können.

Hier kommt das CPU-Fenster:

Delphi-Quellcode:
procedure TJvHookInfos.WindowProc(var Msg: TMessage);
var
  TmpHookInfo: PJvHookInfo;
  { FStack[Index] is used to travel through the hook infos;
    FStack[Index] points to the current hook info (and might be nil)
    Note that the address of FStack may change due to ReallocMem calls in
    IncDepth; thus we can't assign FStack[Index] to a local var.
  }
  Index: Integer;
begin
  { An object can now report for every possible message that he has
    handled that message, thus preventing the original control from
    handling the message; this is probably not a good idea in the case
    of WM_DESTROY, WM_CLOSE etc. But that's the users responsibility,
    I think }

  Msg.Result := 0;

  IncDepth;
  // (rb) Don't know what the performance impact of a try..finally is.
  try
    { The even members in the stack are hoBeforeMsg hooks }
    Index := 2 * (FStackCount - 1);
    FStack[Index] := FFirst[hoBeforeMsg];
    while Assigned(FStack[Index]) do
    begin
      { We retrieve the next hook info *before* the call to Hook(), because,
        see (I) }
      TmpHookInfo := FStack[Index];
      FStack[Index] := FStack[Index].Next;
      if TmpHookInfo.Hook(Msg) or FControlDestroyed then
        Exit;
      { FStack[Index] may now be changed because of register/unregister calls
        inside HookInfo.Hook(Msg). }
    end;

    { Maybe only exit here (before the original control handles the message),
      thus enabling all hooks to respond to the message? Otherwise if you
      have 2 components of the same class, that hook a control, then only 1 will
      get the message }

    if TMethod(FOldWndProc).Data <> nil then //<-- DA DA DA!!! Er wars!
      FOldWndProc(Msg)
    else
    if TMethod(FOldWndProc).Code <> nil then
      Msg.Result := CallWindowProc(TMethod(FOldWndProc).Code, Handle, Msg.Msg,
        Msg.WParam, Msg.LParam);

    if FControlDestroyed then
      Exit;

    { The odd members in the list are hoAftermsg hooks }
    Index := 2 * FStackCount - 1;
    FStack[Index] := FFirst[hoAfterMsg];
    while Assigned(FStack[Index]) do
    begin
      TmpHookInfo := FStack[Index];
      FStack[Index] := FStack[Index].Next;
      if TmpHookInfo.Hook(Msg) or FControlDestroyed then
        Exit;
    end;
  finally
    DecDepth;
    if (Control = nil) and (Msg.Msg = WM_DESTROY) then
      // Handle is being destroyed: remove all hooks on this window
      ControlDestroyed;
  end;

  { (I)
         HookInfos before                               HookInfos after
         call to Hook()                                 call to Hook()

        |----------|  If FStack[Index] point to A       |----------|
     -->| hook A  |  (arrow) and hook A deletes itself | hook B  |<--
        |----------|  then after the call to Hook,      |----------|
        | hook B  |  FStack[Index] points to B. If we  | hook C  |
        |----------|  then call Next, FStack[Index]     |----------|
        | hook C  |  points to C (should be B)
        |----------|
      }
end;
[edit] Andere Frage: Warum taucht das Fenster auf? Was muss passieren damit das Fenster angezeigt wird?
Achso, wenn ich das Fenster schließe und wieder auf F9 drücke, kann ich das Programm trotzdem starten. [/edit]


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:34 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz