What is it you are trying to write? Are you creating a game - and animating objects on the screen?
----- Original Message ----- From: "Gajo Istvan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 14, 2004 8:36 AM Subject: [DUG] READ THIS TOO! I've just worked on the problem a bit more. I think it definitively needs tobe done by threading. The code looks kind of like this: procedure TForm1.Button1Click(Sender: TObject); var m: TMoving; x,y,angle: integer; begin m := TMoving.Create; m.ParentWindow := Handle; ShowM(m); // makes the bitmap visible GetXY(x,y,angle); // gets the parameters from another source Move(x,y,angle,m,GetTickCount) // following procedure.. end; procedure TForm1.Move(x,y,angle: integer; M: TMoving; time: integer); begin if time = GetTickCount then begin CalcXY(x,y,angle); // gets new coordinates UpdateM(M); // updates bitmap coordinates Move(x,y,angle,M,GetTickCount+2) // call itself with new time end else Move(x,y,angle,M,time) // call itself with same time end; So, until time = GetTickCount the procedure will call itself. The trouble is that since my processor probably does a few million jobs in one milliseconds, the procedure will be called so much that a stack overflow will happen. The procedure will never get the chance to call itself again in 2 ms. This could be solved if the calling procedure would be removed from the stack after the new one was called. How to do this? Reading the help file I found out that TThread has something like activating on a signal, so this would probably be a better solution. However, as I already mentioned, I don't know how to use threads. :( Gajo ---------------------------------------------------------------------------- ---- > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
