🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10546

Re: User Interface Thread

#10546
From: Damon Chandler (TeamB)
Date: Fri, 02 Apr 2004 13:16
21 lines
2005 bytes
Hi,
   You can have your secondary thread use the PostMessage() or 
PostThreadMessage() Win32 function to post messages to the 
user-interface thread.  (As you mentioned, this will take care of 
synchronization because the messages must pass through the UI thread's 
message queue.)  To use the PostMessage() function, you need a handle to 
a window that's created by the UI thread (e.g., Application->Handle or 
Form1->Handle).  To use the PostThreadMessage() function, you need the 
identifier of the UI thread (returned via the GetCurrentThreadId() Win32 
function).  Then, in your UI thread, you'd look for the specific 
message(s), and then update the UI accordingly.

Good luck,
-- 
Damon (TeamB)


p Anders wrote:
> How do I invoke the my applications main thread (the user interface thread)
> to update the state of objects contained on a form without worrying about
> data synchronization issues?
Technical Details
Message-ID: <406d6771@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!news.glorb.com!ecngs!feeder.ecngs.de!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <406c756d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,3efebec5b7748a04
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-04-02 05:39:54 PST
Date: Fri, 02 Apr 2004 08:16:47 -0500
From: "Damon Chandler (TeamB)" <dmc27@cornell.edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: User Interface Thread
References: <406c756d$1@newsgroups.borland.com>
In-Reply-To: <406c756d$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 24.58.5.101
Message-ID: <406d6771@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1080911729 24.58.5.101 (2 Apr 2004 05:15:29 -0800)
Lines: 21
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!news.glorb.com!ecngs!feeder.ecngs.de!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail