BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

getting a component to call a function without using a TTime

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
gary
Guest





PostPosted: Tue Apr 26, 2005 12:24 pm    Post subject: getting a component to call a function without using a TTime Reply with quote



If I want my component to perform a task, say, checking if there is data in
the inbuffer, on a regular basis, how would I do this without resorting to a
TTimer. In other words, is there a more elegant way of doing things.

Any ideas will be much appreciated.


Back to top
JD
Guest





PostPosted: Tue Apr 26, 2005 12:32 pm    Post subject: Re: getting a component to call a function without using a T Reply with quote




"gary" <user (AT) home (DOT) com> wrote:
Quote:

how would I do this without resorting to a TTimer.

Use a thread.

~ JD


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Apr 26, 2005 5:09 pm    Post subject: Re: getting a component to call a function without using a T Reply with quote




"gary" <user (AT) home (DOT) com> wrote


Quote:
If I want my component to perform a task, say, checking if there
is data in the inbuffer, on a regular basis, how would I do this
without resorting to a TTimer. In other words, is there a more
elegant way of doing things.

You don't need to use TTimer if you want a timer. You can call the Win32
API SetTimer() function directly, assuming your component has its own HWND
to receive the WM_TIMER message with. Alternatively, there is
timeSetEvent(), which is a threaded multimedia timer.


Gambit



Back to top
Rob
Guest





PostPosted: Wed Apr 27, 2005 12:17 pm    Post subject: Re: getting a component to call a function without using a T Reply with quote

gary wrote:

Quote:
If I want my component to perform a task, say, checking if there is
data in the inbuffer, on a regular basis, how would I do this without
resorting to a TTimer. In other words, is there a more elegant way of
doing things.


Most obvious way is to create a worker thread that does the task, calls
Sleep() for some specified number of milliseconds. If the task
involves writing data that the component needs, it is necessary to
synchronise access to that data. It is usually necessary to have some
polite way of telling the thread to terminate.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.