title: Easiest way to pop up a progress bar dialog from C++ dll (windows)
body: <p>I am writing a dll which is a COM wrapper for another dll (the inner dll) without COM support.  The inner dll performs a lengthy computation and lets the outer dll know how progress is going via a callback function.  The outer dll just makes the functions visible over COM.</p>
  
  <p>However, I need the outer dll to pop up a progress bar dialog (the COM client I'm serving can't do this itself for various reasons).  So how do I go about doing that?  All examples I have seen so far revolve around Win32 apps which have a <code>WinMain</code> entry point; what can be done if we're already in a dll call when the dialog is needed?</p>
  
  <p>I'm new to windows GUI programming, so quite out of my depth here.  The existing code is included below - specific suggestions on what to call where would be appreciated.  I'm guessing I may need to fire off a second thread to refresh the progress dialog.</p>
  
  <p><strong>Inner dll .h file (for implicit linking):</strong></p>
  
  <pre><code>#define INNER_API extern "C" __declspec(dllimport) 
  
  //create calculation, passing callbacks for warning messages and progress bar
  INNER_API Calculation* __stdcall calc_create(...blah...,
      int (__cdecl *set_progressor_callback)(long),
      int (__cdecl *print_warning_callback)(const char*));
  
  INNER_API void __stdcall calc_run(Calculation *c);
  </code></pre>
  
  <p><strong>Then in the outer dll, the com wrapper, ComWrapperObject.cpp:</strong></p>
  
  <pre><code>    int my_progressor_callback(long progress)
      {
           //set progressor to equal progress, but how?
           return 0;
      }
  
      STDMETHODIMP ComWrapperObject::do_calculation()
      {
          //fire up progress bar and message window here, but how?
  
          Calculation *calc = calc_create(...blah..., &amp;my_progressor_callback);
          calc_run(calc);
  
          //wait for user to dismiss message window, but how?
          return S_OK;
      }
  </code></pre>