how do I hide other running applications?
how do I hide other running applications?
- Subject: how do I hide other running applications?
- From: Rob Ross <email@hidden>
- Date: Tue, 12 Sep 2006 23:39:02 -0700
I seem to have two choices, by calling -hideOtherApplications on
either NSApplicaion or NSWorkspace. But neither seems to be working
for me.
I'm calling them from a JNI native method, called from a Java class.
Here's my Java class:
public class ApplicationTesting
{
public native void hideOtherApps();
public static void main(String[] args)
{
final ApplicationTesting app = new ApplicationTesting();
app.hideOtherApps();
}
static
{
System.loadLibrary("StringProcessing"); //all libraries in
this test package are included in this
}
}
My native method is :
JNIEXPORT void JNICALL Java_ApplicationTesting_hideOtherApps(JNIEnv
*env, jobject ojb)
{
//test one : can we get a reference to an NSApplication?
NSApplication *app = [NSApplication sharedApplication];
if (app == nil || app == NULL)
{
printf("NSApplication object is nil\n");
return;
}
//show some info on the app
BOOL isActive = [app isActive];
printf( (isActive == YES) ? "app is active\n" : "app is NOT
active\n" );
BOOL isRunning = [app isRunning];
printf( (isRunning == YES) ? "app is running\n" : "app is NOT
running\n" );
BOOL isHidden = [app isHidden];
printf( (isHidden == YES) ? "app is hidden\n" : "app is NOT
hidden\n" );
//try to hide other apps
printf("Calling hideOtherApplications\n");
[[NSApplication sharedApplication]
performSelectorOnMainThread:@selector(hideOtherApplications:)
withObject:NULL waitUntilDone:NO];
[[NSWorkspace sharedWorkspace]
performSelectorOnMainThread:@selector(hideOtherApplications)
withObject:NULL waitUntilDone:NO];
}
running my Java main() from the Terminal app (command line) results
in this output:
app is NOT active
app is running
app is NOT hidden
Calling hideOtherApplications
but alas, no other apps actually get hidden.
What might I be doing wrong?
Thanks,
Rob Ross, Lead Software Engineer
E! Networks
email@hidden
---------------------------------------------------
"Beware of he who would deny you access to information, for in his
heart he dreams himself your master." -- Commissioner Pravin Lal
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden