   Timer in CBuilder
  Hey all, another cbuilder question:How can I get a good timer-method done using cbuilder (the mfc-like stuff) I currently still use the TTimer-control, but it''s way to slow to actually get 30 fps, let alone more... Does anyone here know of a way to do it with a while-loop, but one that doesnt interfere with the rest of the controls on the forms (like the chatbox  ) ? tnx in advance 
  Hi there,assign application->onidle and application->onmessage event handlers ( you need to set Handled = false in the onidle handler ).alternativly if you have a TApplicationEvents component ( from the additional vcl palette ), drop it on the form and use its onmessage and onidle eventsHope it helpsMark ;  Using the applicationevents component it didnt work, it would only update once every second or so, unless i was moving the mouse.I dont know though how to do that first option you gave me... could you explain more? escpecially since this project will most likely be finished in a personal edition which, if im not mistaken, doesnt have that component? ;  plz (just keeping this thread from disappearing  ) ;  Hi there,tie in the following to the TApplicationEvents object( the following is delphi code so it will need a little conversion into c++ but will do the trick )procedure TForm1.ApplicationEvents1Idle(Sender: TObject;  var Done: Boolean);begin  Inc(I);  Caption := Format('%d',);  //replace with render code  Done := false;end;procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;  var Handled: Boolean);begin  Inc(I);  Caption := Format('%d',);  //replace with render code<br>end;<br><br>Hope it helps <br><br>Mark<br><br>   </i>    <br><br><SPAN CLASS=editedby>[edited by - MButchers on July 31, 2003 8:05:37 AM]</SPAN>;  Hey I do not know how helpful this comment will be but with VC++ you can get a high performance timer.  I am not sure what it runs off of but I get more than 3,000,000 ticks per second.  you use LARGE_INTEGER to store it(otherwise it will overflow after 60 minutes) and you access it like thisLARGE_INTEGER Frequency;// this tells you how many ticks you will get per secondQueryPerformanceFrequency(&Frequency);then you callLARGE_INTEGER startTime = 0;LARGE_INTEGER currentTime = 0;QueryPerformanceCounter(&startTime);QueryPerformanceCounter(&currentTime);then to get how long has passed you just subtract the startTime from the currentTime.Don''t know if this helps but here it is. ;  cbarrett is correct, and the High performance timer has NOTHING to do with VC, but instead is pure Win32 API, so it can be used from any C/C++ compiler which supports building windows programs.  I have a high performance timer library wrapped around it that supports instantiating new PerformanceTimer and telling it what message code and wparam you want posted to your windows ... and of course how often ... you can easily use numbers in the 4-40 ms range (normal windows timers have 55 ms acuracy) ... which gives you semi-acurate framerates 250 FPS, but due to other threads operating and such, it varies, although I have never had a problem getting 60-100 FPS consistenly, as long as I wasn''t guilty of running over about 3/4th of my time alotment.  When writing a game, I always assume that I (the whole program I''m writing) have between 50% and 80% of the computer, while the other 20-50% is being used by background processes ... gives me realistic expectations of performance. ;  about the performance timer: true, but that would require a while-loop (right?)about the delphi code: what is the Inc(I); ?-edit-kewl, it works, even without that Inc(I); line. Just 1 more question: Why also draw with OnMessage? If I only draw when OnIdle, then it looks the same to me as with both...? (maybe because i'm not yet rendering a lot)   [edited by - Ruudje on August 1, 2003 3:22:57 AM];  Hi there,Inc(I) increments I by one. (not needed just there as it was a bit of demo code)The reason for doing the render on a message is so that if you have a lot of messages pending in the message queyour app will not appear to ''skip''CheersMark ;  tnx. Ive given you special thanks in the about box :D-edit-I noticed though, when the aboutbox is visible, the fps drop :s   [edited by - Ruudje on August 1, 2003 11:10:52 AM]