my delphi 2009 app uses a DLL that performs some activities that may take several seconds. i’d like to show a progress bar. unfortunately the DLL call is a blocking call & has no callback function.
a way i’ve been considering is to add a TTimer to my app. when the timer event fires, i look at the time and use that to calculate the progress % and update the progress bar.
i did that, would i have problems with the fact that the VCL is not thread safe?
thank you!
I don’t know much about Delphi but if it runs on windows , you might need to do this.
1) Because your user interface is not thread safe, you need to PostMessage into the user-interface thread to update the progress bar.
2) If your user-interface thread is the thread calling into the DLL, then you wont be pumping messages, so you cant update your user-interface. You could call MsgWaitForMultipleObjectsEx to continue pumping messages while waiting, but since the wait is within the DLL , you dont have a handle to wait for. Is it possible to move your call into the DLL to another thread ? Then you can wait on that thread handle. This way your progress bar will continue to operate.
I dont know much about Delphi, but my colleagues tell me it runs Win32 based function calls, so it operates very much like a windows program on windows.