Article View: borland.public.cppbuilder.nativeapi
Article #16276Developing an application that never freezes?
From: Chris
Date: Sun, 25 May 2003 18:54
Date: Sun, 25 May 2003 18:54
25 lines
2046 bytes
2046 bytes
One thing I hate about debugging are those dreaded infinite loops. I end up losing more and more memory every time I have to end-task. You'd think 768 megs of ram would be enough, but its like every time I do that I can have less and less windows open without getting errors. I was thinking, though. In each loop you could call Application->ProcessMessages(); Run a GetAsyncKeyState timer (they usually take less than 1% cpu usage on 233 MHZ machines). Add one line of code to each loop. if(Canceled()) break; Canceled would run Application->ProcessMessages(); and return the value of Cancel. Cancel would be a 'master cancel' value that the GetAsyncKeyTimer would set if your form was focussed and a certain hotkey pressed. This would cancel any and all loops, and then the application could exit smoothly, or at least, more smoothly than before, and probably very smoothly if you add try catch statements to your OnDestroy(etc) code in case you get access violations, that way your program can still free most of its memory... Sound good?
Technical Details
Message-ID:
<3ed11154$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2d9595300482e087,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-25 11:55:50 PST From: "Chris" <Chris8852@adelphia.net> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Developing an application that never freezes? Date: Sun, 25 May 2003 14:54:11 -0400 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 68.65.164.124 Message-ID: <3ed11154$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1053888852 68.65.164.124 (25 May 2003 11:54:12 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail