title: Get modal dialog handle for PrintDialog
body: <p>I have an windows app on .net 2.0. On <code>Form1</code>, I open a <code>PrintDialog</code>. How can I get that dialog's handle from my code?</p>
  
  <p>I have tried a lot of win32 functions: <code>EnumWindows</code>, <code>EnumChildWindows</code>, <code>FindWindow</code>, <code>FindWindowEx</code> but it cannot find my <code>PrintDialog</code>. All I can find is just <code>Form1</code> and its children are controls on it. There's no way I can get <code>PrintDialog's</code> handle.</p>
  
  <p>Some code that i have tried:</p>
  
  <p>Import win32:</p>
  
  <pre><code>    [DllImport("user32.dll", SetLastError = true)]
      public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  </code></pre>
  
  <p>calling win32 functions:</p>
  
  <pre><code>using (PrintDialog dlg = new PrintDialog
                                   {
                                       AllowCurrentPage = false,
                                       AllowSomePages = true,
                                       AllowSelection = false
                                   })
  {    
        IntPtr printHandle = CustomPrintDialog.FindWindow("#32770", "Print");
        // some logic with printHandle go here
        if (dlg.ShowDialog(this)==DialogResult.OK){
            // some logic go here
        }
  }
  </code></pre>
  
  <p>I have checked with Spy++, there is still a <code>PrintDialog</code> window. That <code>PrintDialog</code> window has Parent Window's handle exactly same as <code>Form1's</code> handle.</p>
  
  <p>Does anyone can help me to get a <code>PrintDialog's</code> handle from its parent window?</p>