Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Synchronize - TThreadMethod with parameters?

Posted on 2006-06-14
Medium Priority
Last Modified: 2013-11-17

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?

Question by:cleaverX
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
LVL 11

Expert Comment

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 *
LVL 16

Accepted Solution

George Tokas earned 200 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.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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…

636 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