title: makeKeyAndOrderFront doesn't do either
body: <p>I've got an application that runs at startup as a menu in the OS X menu bar (i.e., as a background application). When you select an option from the menu, it transforms into a foreground application (creating a dock icon) and shows a window.</p>
  
  <p>Here's the background/foreground code I'm using:</p>
  
  <pre><code>+(void) TransformToForegroundApplication {
      ProcessSerialNumber psn = { 0, kCurrentProcess };
      TransformProcessType(&amp;psn, kProcessTransformToForegroundApplication);
  }
  
  +(void) TransformToBackgroundApplication {
      ProcessSerialNumber psn = { 0, kCurrentProcess };
      TransformProcessType(&amp;psn, kProcessTransformToUIElementApplication);
  }
  </code></pre>
  
  <p>Pretty standard stuff, from the looks of things. And it works fine, except for one small issue.</p>
  
  <p>The problem is that after I call TransformToForegroundApplication, I call makeKeyAndOrderFront: on the window to make it come to the front of the Z-order and receive focus - but it does neither. It shows up in the background, underneath everything else. I need to either click on the dock icon, or minimize all of the windows in front of it and then click on that window, in order to bring it to the front.</p>
  
  <p>Any ideas?</p>