Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Oats

macrumors regular
Original poster
Jan 8, 2003
194
1
New York
I've got a utility app I'm developing for OS X (hopefully targeting 10.5 and up). My window floats above other windows, and occasionally I want to hide the my app/window and let users continue running whatever program was behind it. Similar to if the user pressed "cmd-H" to hide my app.

The problem is, I don't know how to do this programmatically with cocoa. I can hide my window, but my app's menubar is still frontmost. Things I have tried that did not work:

Code:
[NSApp hide:self];
[NSApp deactivate];

Please help, thanks!
 
In formulating the question for this post, I finally was able to choose the right google keywords to lead me to a solution. This seems to work:
Code:
	ProcessSerialNumber psn;
	GetFrontProcess (&psn);
	ShowHideProcess (&psn,false);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.