Tag: carbon

List of all users and groups

I’m trying to get a list of all users and all groups on Mac OS X 10.5+. How can I do this? For example, the list of all users on my machine should return: _amavisd, _appowner, _appserver, _ard, _atsserver, _calendar, _carddav, _clamav, _coreaudiod, _cvmsroot, _cvs, _cyrus, _devdocs, _dovecot, _eppc, _installer, _jabber, _lda, _locationd, _lp, _mailman, […]

Prevent `mouseMovedEvent` callback from processing the movement? Or globally hide cursor momentarily?

I have a global app that prevents the mouse from moving into areas of the screen. Must work with all apps, while my app in the background, etc. I have set up a CGEventTap hook that has a callback for mouse movements. The user’s mouse movement continues to pass through the hook, no matter how […]

How to get other application to paste from my global hotkey

I have written a small productivity tool that does a few string manipulations via the clipboard. It is currently registering a hot key, where it pulls in the clipboard text, processes it, and dumps the result back on the clipboard. I have this installed on CMD+SHIFT+V currently what you need to do from another apppiclation […]

How to display file copy progress in 10.8

FSCopyObjectAsync is Deprecated in OS X v10.8, Now how to display progress indictor for file copy operation.

Where does the Finder obtain the “date added” of an item in a folder?

If a folder is placed in the Dock you can sort it by “date added” – this is usually the default for the Downloads folder. (Sometimes the Finder does not appear to be using the date added but the date modified, but it can find the date added.) Where is the Finder figuring this out […]

Displaying file copy progress using FSCopyObjectAsync

It appears after much searching that there seems to be a common problem when trying to do a file copy and show a progress indicator relative to the amount of the file that has been copied. After spending some considerable time trying to resolve this issue, I find myself at the mercy of the StackOverflow […]

Getting Window Number through OSX Accessibility API

I am working on an application that moves windows of third party applications around on the screen. To get an overview of all currently open windows, I use CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID); This returns an array of dictionaries defining every open window. Here’s an exemplary dictionary returned: { kCGWindowAlpha = 1; kCGWindowBounds = { Height […]

Is there a way to check if process is 64 bit or 32 bit?

I am trying to find process type (32 bit/ 64bit) from process pid? I get the process information and process list from using GetBSDProcessList method described here. how can we get the process type information? Any Ideas? I can use defined(i386) or defined(x86_64) but only if we are in process. I am out of the […]

Typedef redefinition of UInt32 in MacTypes.h, from definition in CFBase.h

I’m getting a typedef redefinition error on two lines in MacTypes.h, in the following chunk of code: #if __LP64__ typedef unsigned int UInt32; typedef signed int SInt32; #else typedef unsigned long UInt32; // error here typedef signed long SInt32; // error here #endif The Clang error points to the following previous definition, in CFBase.h (in […]

Monitor keyboard events inside process (Process Wide)

I can install system wide keyboard monitor by the below instructions: CGEventRef eventCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *userData) { } CFMachPortRef eventTap = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, kCGEventKeyDown, &eventCallback, NULL); if(eventTap) { CFRunLoopSourceRef eventRunLoopSourceRef = CFMachPortCreateRunLoopSource(NULL, eventTap, 0); CFRelease(eventTap); CFRunLoopAddSource(CFRunLoopGetCurrent(), eventRunLoopSourceRef, kCFRunLoopDefaultMode); CFRelease(eventRunLoopSourceRef); } The disadvantage of this code is that it requires to […]