title: Using modal progress bar dialogs in Windows CE?
body: <p>I'm writing a Windows CE application in C++ directly applying the WINAPI. In this application I parse a text file, which may or may not be large and thus may or may not take a while to load; and as I will add functionality to load files across the wireless network, I figured it would be best to add a progress bar.</p>
  
  <p>My aim is to display the progress bar in a modal dialog, thereby preventing the user from interacting with the main window. A thread is then created to perform the loading in the background, leaving the main thread to update the GUI.</p>
  
  <p>However, using <code>EndDialog()</code> prevents me to return to the code which loads the file until the dialog has been closed. Obviously I want to show the dialog and <em>then</em> load the load, periodically updating the progress from the background thread. At this point I only know of two options to circumvent this:</p>
  
  <ol>
  <li>Create the dialog using <code>CreateDialog</code>, modify the message handler to accommodate messages designated to the dialog, disable the main window and lastly create the background thread.
  </li>
  <li>
  Create the background thread in a suspended initial state, create the dialog using <code>DialogBoxParam</code> passing along the thread ID, and when capturing the <code>WM_INITDIALOG</code> resume the thread.
  </li>
  </ol>
  
  <p>Although any of these two would probably work (I'm leaning towards the second option), I'm curious about whether this is the way progress bars are supposed to be handled in a Windows environment -- or if there is a leaner, more clever way of doing it.</p>