Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Jan : A couple of thread questions..

www.cryer.info
Managed Newsgroup Archive

A couple of thread questions..

Subject:A couple of thread questions..
Posted by:"Richard Bibby" (richardjbib..@hotmail.com)
Date:Thu, 1 Feb 2007 00:15:20

Hi!

I have a couple of questions related to threads. My application architecture
is as follows:

My application calls a (delphi) dll.  This dll creates and executes a
thread. In the thread I create and display a borderless window.

Question 1: How do I hide the created window from that task bar.  My main
app has a task bar icon, but I do not want one for the window created in the
thread.

I have used ShowWindow( Appliction.Handle, sw_hide ) in the OnActivate event
of the window but without success.  I guess this is because I am creating it
in a dll.  What handle should I pass in?


Question 2: Each time the dll is called it creates a thread but I only want
one instance of the thread running at anyone time.  How can I ensure this
happens.  Can I search for my thread class and only start a new thread of I
don't find an instance of the class? Or should I keep some global variable
that has the thead id and check for that each time.

I assume I can loop round waiting for the thread to finish (or use WaitFor?)

/Richard

Replies:

www.cryer.info
Managed Newsgroup Archive