macos-carbon

How to Identify if the process in User Interface Process?

亡梦爱人 提交于 2019-12-19 10:32:17
问题 How can I get information from a process that it is UI(User Interface) process or non-ui? With UI process I mean, Finder, Dock, System UI server, or any other mac application which has UI interface and it is used by Window Server. I want to determine this information from ProcessID. I am using mac os x. 回答1: There is no way to determine based purely on the PID number what a specific process is. The reason for this: Process IDs are assigned (somewhat) sequentially from PID=1 on startup, and

How to Identify if the process in User Interface Process?

倾然丶 夕夏残阳落幕 提交于 2019-12-19 10:31:15
问题 How can I get information from a process that it is UI(User Interface) process or non-ui? With UI process I mean, Finder, Dock, System UI server, or any other mac application which has UI interface and it is used by Window Server. I want to determine this information from ProcessID. I am using mac os x. 回答1: There is no way to determine based purely on the PID number what a specific process is. The reason for this: Process IDs are assigned (somewhat) sequentially from PID=1 on startup, and

Disable CMD+Tab application switcher

ⅰ亾dé卋堺 提交于 2019-12-18 16:53:48
问题 I'm trying to disable the CMD + Tab application switcher, so that my application can register that hotkey. I'm looking for something that applications like Witch and LiteSwitch X are able to do (i.e. allow users to use CMD + Tab as the hotkey for my application). How are they able to do that? 来源: https://stackoverflow.com/questions/3256651/disable-cmdtab-application-switcher

Global Mouse Moved Events in Cocoa

半城伤御伤魂 提交于 2019-12-18 10:56:20
问题 Is there a way to register for global mouse moved events in Cocoa? I was able to register for the events using Carbon's InstallEventHandler() , but would prefer a Cocoa equivalent. I have looked for NSNotificationCenter events, but there doesn't seem to be any public event names (are there private ones?) Alternatively, is there a way to use NSTrackingArea for views with a clearColor background? The app is Snow Leopard only. 回答1: In SnowLeopard there is a new class method on NSEvent which does

How can I set the mouse position?

北城余情 提交于 2019-12-18 07:11:50
问题 I need to set the position of the mouse on the screen. In some other similar question, it was suggested to use CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CGPoint point) , but I cannot figure out how to get the CGDirectDisplayID . Please tell me how to get the CGDirectDisplayID or a different method to set the mouse position. 回答1: The real answer to this question is: CGMainDisplayID() https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref

How to force Mac window to foreground?

你。 提交于 2019-12-18 06:19:02
问题 How can I programmatically force a mac window to be the front window? I have the window handle, and want to ensure that my window is displayed above all other windows. I can use both Carbon & Cocoa for this. 回答1: For Cocoa, you can set the window level using: [window setLevel:NSFloatingWindowLevel]; A floating window will display above all other regular windows, even if your app isn't active. If you want to make your app active, you can use: [NSApp activateIgnoringOtherApps:YES]; and [window

Finding DNS server settings programmatically on Mac OS X

自作多情 提交于 2019-12-17 20:37:49
问题 I have some cross platform DNS client code that I use for doing end to end SMTP and on windows I can find the current DNS server ip addresses by looking in the registry. On the Mac I can probably use the SystemConfiguration framework as mentioned in the first answer, however the exact method of doing so is not immediately obvious. For instance SCDynamicStoreCopyDHCPInfo returns some of the dynamic DHCP related data but not the DNS server addresses. 回答1: They are also available from /etc

Convert Virtual Key Code to unicode string

≯℡__Kan透↙ 提交于 2019-12-17 20:19:52
问题 I have some code I've been using to get the current keyboard layout and convert a virtual key code into a string. This works great in most situations, but I'm having trouble with some specific cases. The one that brought this to light is the accent key next to the backspace key on german QWERTZ keyboards. http://en.wikipedia.org/wiki/File:KB_Germany.svg That key generates the VK code I'd expect kVK_ANSI_Equal but when using a QWERTZ keyboard layout I get no description back. Its ending up as

Add Item to Finder Sidebar

天涯浪子 提交于 2019-12-17 19:45:46
问题 I would like to add a new item to the Finder sidebar. I found out that the Finder keeps the list of "places" in `~/Library/Preferences/com.apple.sidebarlists.plist. I was able to read the file using Carbon API and saw that each item had Name, icon and alias. Using a 3rd party application such as PlistEdit Pro I was able to update the alias. My question is how to update the alias using Carbon API. Was not able to find a way to create alias that will open in Finder. It seem that both Dropbox

Getting a unique ID for a window of another application

好久不见. 提交于 2019-12-17 16:24:53
问题 I'm a newbie Cocoa developer and I'm developing my first application. I want to read a unique identifier from any window of any application - whether it's Cocoa or Carbon. Cocoa applications make their window IDs available to AppleScript (although I'm sure there's a much better way to do this through a proper Objective C route), but I'm trying to access window IDs from documents in the Adobe apps. This seems to be a lot trickier. All I can seem to find in the reference libraries is