Solved

Synchronize - TThreadMethod with parameters?

Posted on 2006-06-14
4
1,451 Views
Last Modified: 2013-11-17
Hi,

I was wondering if if can pass a function with parameters in the Synchronize function?

I would like to update a progressbar to a position specified in the thread.  Is this possible, if not, what's the best solution to do this?

Greets.
0
Comment
Question by:cleaverX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 16901732
I cant remeber the function header for this but if the function accepts a function pointer and a void * parameter you pass you variable via the void *
0
 
LVL 16

Accepted Solution

by:
George Tokas earned 50 total points
ID: 16902000
>>I cant remeber the function header for this but if the function accepts a function pointer and a void * parameter you pass you variable via the void *

From C++Builder4 Unleashed page 211

The function declaration for a function called via synchronize() must have the following declaration:
void __fastcall Function();
Any other function declaration will result in a compiler error.

So... Declare the position inside the thread as public, update it from the main thread (Main form), and call Synchronize() to display it.

George Tokas.
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question