Simon Gulliver
September 10th, 2001, 10:12 AM
I have a free-threaded component, written in C++, which waits on RS232 I/O and does a callback when reading or writing data.
In VB, I have created a Class Module with "Implements xxxLib.Icallback". This callback works successfully when working with local or global data; so, for example, you can store received data in an array. BUT VB crashes when trying to write to a CONTROL on a form.
In the Win32 API, you would be using PostMessage to send the data across thread boundaries when your callback was received. In VB, I assume that VB is treating the controls as ActiveX objects and it doesn't like talking to an apartment-threaded ActiveX object while in a callback from a free-threaded component. But this doesn't solve my problem...
At the moment, I have the truly dreadful "solution" of saving callback data in an array and polling with a timer in my main form. There must be a better way, surely....
In VB, I have created a Class Module with "Implements xxxLib.Icallback". This callback works successfully when working with local or global data; so, for example, you can store received data in an array. BUT VB crashes when trying to write to a CONTROL on a form.
In the Win32 API, you would be using PostMessage to send the data across thread boundaries when your callback was received. In VB, I assume that VB is treating the controls as ActiveX objects and it doesn't like talking to an apartment-threaded ActiveX object while in a callback from a free-threaded component. But this doesn't solve my problem...
At the moment, I have the truly dreadful "solution" of saving callback data in an array and polling with a timer in my main form. There must be a better way, surely....