Can I hide the dock icon programmatically

Can I hide the dock icon programmatically on demand. I know one way in which the definition of the property "Application is an agent (UIElement)" in plist we make the cocoa application as a user agent. But this result constantly hides the dock icon.

I am looking for a way that I can control the visibility of the dock icon. Any ideas?

+4
source share
1 answer

Unfortunately not. You can convert a background application to a foreground application using the TransformProcessType() function, but you cannot go from a foreground application to a background application.

Here's how to go from the background to the foreground:

 ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); if( returnCode != 0) { NSLog(@"Could not bring the application to front. Error %d", returnCode); } 
+5
source

Source: https://habr.com/ru/post/1309751/


All Articles