Multiple threads in an app - HowTo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!
In our current app we display a splash screen form(running on a separate
thread) while some data access operations take place. Once the operations are
finished, we display the main app form. This is working just fine.

Now, we are adding a functionality to see if a configurationsettings file on
the device has all the values we need before the app loads(even before the
splash screen). If a value doesn't exist, we display a form, get the
user-input, update the configuration file and then WANT to continue loading
the app.

This new form will only be displayed if some settings are missing. I am not
able to close this new form or kill the thread and continue loading the app.
How should I be resolving this issue? Any ideas/suggestions will help a lot.

Thanks and regards,
Kumar
 
The problem is you're showing UI from a worker thread, which is a no-no
unless it has its own message pump.

-Chris
 
Message pump?? I am not sure I follow. What should be a better approach then
to do what I want to do?

Thank you for your time.
Regards,
Kumar
 
The answer is either use the primary UI thread for displaying info through
Invoke calls or create a new message pump on your new thread to handle all
UI stuff for the new UI. I'd opt for the fisrt as the second has many
potentials for getting things seriously hosed up.

-Chris
 
Thank you Chris! I will prefer using the primary UI thread and modify the
logic or flow of the program.

Regards,
Kumar
 
Back
Top