title: Bring a window to foreground without window handle
body: <p>I have a Windows CE embedded 6.0 application that opens another app in the background, and I want to bring the other app to the front. I first tried SetParent with the third party app's MainWindowHandle and it didnt work. I then tried SetActiveWindow on the same MainWindowHandle again and it didnt work. This led me to believe that the MainWindowHandle was messed up, and when I print it on the console, its always 0. This brings me to my first question: Is it possible that the dev for the app forgot to mention what the MainWindow is? Or is it assigned automatically in .NET?</p>
  
  <p>Secondly, now that that approach failed, I tried to EnumWindows, then get the ID for each window and match it to the process Id I knew for my required program. This gave me an exception 0x80131515 saying "EnumWindows" is not supported. I have imported EnumWindows from CoreDll just fine. Second question: what could be the cause of this error? What am I doing wrong?</p>
  
  <p>Sorry! Here's some code (Assume VCProcess has already been started):</p>
  
  <pre><code>    [DllImport("coredll.dll")]
  static extern int EnumWindows(CallbackDef callback, int lParam);
  
      [DllImport("coredll.dll")]
      static extern int GetWindowThreadProcessId(IntPtr hWnd, int pid);
  
      static void Main()
      {
          callBackPtr = new CallBackPtr(Report);  
          EnumWindows(callBackPtr, 0);
      }
  
      public static bool Report(int hwnd, int lParam)
      {
          int pid = 0;
          GetWindowThreadProcessId(hWnd, pid);
          if (pid == VCProcessId)
          {
              SetForegroundWindow(hWnd);
          }
          MessageBox.show("Window handle is "+hwnd);
          return true;
      }
  </code></pre>