title: Send text to "save as" dialog
body: <p>I have winapi c# to save webpage as pdf. Application uses control + P on webpage and hit enter. My default printer is "nuance pdf" and I want to save the file as pdf. My code looks as below:</p>
  
  <pre><code>static class Program
  {
      [DllImport("user32.dll")]
      public static extern int SetForegroundWindow(IntPtr hWnd);
  
      [DllImport("User32.dll")]
      public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, string lParam);
  
      [DllImport("user32.dll")]
      public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  
      [DllImport("user32.dll")]
      public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
  
      [STAThread]
      static void Main()
      {
          Boolean Check = true;
          string text = "MyFileName";
  
          while (Check)
          {
              Process[] processes = Process.GetProcessesByName("iexplore");
              foreach (Process proc in processes)
              {
                  SetForegroundWindow(proc.MainWindowHandle);
                  SendKeys.SendWait("^(p)");
                  SendKeys.SendWait("{ENTER}");
                  var handle = FindWindow(null, "Save As");
                  Console.WriteLine("handle {0}", handle);
                  //SendMessage(handle, 0x000C, IntPtr.Zero, text);
                  SendKeys.SendWait("{ENTER}");
              }
              Check = false;
          }
      }
  }
  </code></pre>
  
  <p>This code saves the file name as "https___www.google.pdf". I would like to change the file name (highlighted). </p>
  
  <p><a href="https://i.stack.imgur.com/WEXMx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WEXMx.png" alt="enter image description here"></a></p>
  
  <p>How do I do that? Any pointers? 
  Thanks for helping out. </p>