I’m using BitListenerStop and then BitListenerDestroy afterwards on my application. In most cases, my application then lags/hangs. What could cause the lag?
The call of BitListenerStop() is passed through the message queue of your application. By calling BitListenerDestroy() immediately afterwards you are trying to destroy an object which is currently in use. As a result, your application becomes unresponsive and thus “hangs”. This is the same for other listener objects like DWORDListener for instance.
To avoid this behavior you can call DoEvents() between the two calls you’ve mentioned to enable the process to handle the listener message before the object gets destroyed.
This seems to work, thanks!