macos-carbon

SGNewChannel error -9405 on Mac 10.9.1

怎甘沉沦 提交于 2020-01-13 05:16:11
问题 I am getting an error –9405, couldntGetRequiredComponent , with SGNewChannel(m_Grabber, VideoMediaType, &m_Channel) on Mac system 10.9.1. This code works on older systems. Is anyone else having this issue? Edit - Initialization code: // standard SG initialization err = OpenADefaultComponent(SeqGrabComponentType, 0, &m_Grabber); err = SGInitialize(m_Grabber); err = SGSetDataRef(m_Grabber, 0, 0, seqGrabDontMakeMovie); 回答1: After spending some time reverse engineering what SGNewChannel does on

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

China☆狼群 提交于 2020-01-10 04:11:29
问题 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 from? The standard file metadata, i.e. as obtained by stat, getattrlist or FSGetCatInfo) does not contain it. TIA 回答1: Yep, the date added could be inferred from other structures. In fact, it resides in Spotlight

Translate into Apple Events AppleScript

北慕城南 提交于 2020-01-06 08:26:29
问题 I have an very simple applescript: tell application "Opera" get URL of active tab of window 1 end tell I want to see Apple Events underlying. So I have launched it with these two environment variables enabled: export AEDebugSends=1; export AEDebugReceives=1 Now I am getting this output: osascript browser.scpt {core,getd target='psn '[Opera] {----={form=prop,want=prop,seld=URL ,from={form=prop,want=prop,seld=acTa,from={form=indx,want=cwin,seld=1,from=NULL-impl}}}} attr:{csig=65536 returnID

Equivalent Carbon 32-bit call for using in 64-bit application - GetApplicationEventTarget()

我的梦境 提交于 2020-01-06 03:13:11
问题 I'm writing a 64-bit Cocoa application. I need to register for global key events. So I wrote this piece of code : - (void)awakeFromNib { EventHotKeyRef gMyHotKeyRef; EventHotKeyID gMyHotKeyID; EventTypeSpec eventType; eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; InstallApplicationEventHandler(&MyHotKeyHandler,1,&eventType,NULL,NULL); gMyHotKeyID.signature='htk1';

Resolving cast to pointer from integer of different size error in 64-bit conversion

て烟熏妆下的殇ゞ 提交于 2020-01-05 04:21:13
问题 I'm working on modifying the PTHotKeyLib to be 64-bit friendly, but I've run into an issue in the code that I'm not sure how to get around. In PTHotKeyCenter, the registerHotKey method create an EventHotKeyID instance and then stuffs the of PTHotKey object into the id attribute. The original code used a long. I converted it to NSInteger per Apple's 64 bit programming guide. - (BOOL)registerHotKey:(PTHotKey *)theHotKey { OSStatus error; EventHotKeyID hotKeyID; EventHotKeyRef carbonHotKey;

Is there a way to get old revisions of Apple Sample Code? [closed]

天大地大妈咪最大 提交于 2020-01-04 02:49:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . For example, I would like to see the pre-Leopard API version of HID Explorer. I see in the revision history that the initial sample was created on 2003-01-14. Is there any way to get that revision? 回答1: Sadly, no. Unless you have an older system restore disc (they came with older versions of Xcode and I think

Get application icon from ProcessSerialNumber

…衆ロ難τιáo~ 提交于 2020-01-04 02:38:07
问题 I would like to get the application icon for all foreground applications running on my Mac. I'm already iterating over all applications using the Process Manager API. I have determined that any process that does not have the modeBackgroundOnly flag set in the processMode (as retrieved from GetProcessInformation() ) is a "foreground" application, and shows up in the task switcher window. All I need is an API that gives me a CImageRef (or similar) that contains the application icon for a

LSEnvironment section of info.plist take no effects.

北战南征 提交于 2020-01-03 16:50:04
问题 I writed a dynamic library that loaded into some target applications by setting environment variable named DYLD_INSERT_LIBRARIES, the dylib load and works fine when application executed from terminal by this commands: $ export DYLD_INSERT_LIBRARIES=/path/to/mylib.dylib $ /path/to/application.app/Contents/MacOS/executable Then I set the value of DYLD_INSERT_LIBRARIES by editing LSEnvironment section in info.plist file. Some apple standard applications such as TextEdit and Calculator load my

Getting keyboard state using GetKeys function

蓝咒 提交于 2020-01-03 05:20:33
问题 Does anyone know how to get any key state (pressed or no) by GetKeys function? In other words how to handle this function: bool result = isPressed(kVK_LeftArrow); Thankyou. 回答1: The KeyMap type is an array of integers but its real layout is a series of bits, one per key code. The bit number for a particular key is one less than the virtual key code. Since bit-shifting isn't legal for very large values (e.g. you can't just ask the compiler to shift 74 bits), the KeyMap type is broken into 4

can't get wxHaskell to work from ghci on Mac

佐手、 提交于 2020-01-02 03:40:19
问题 I'm trying to run an example using EnableGUI function. % ghci -framework Carbon Main.hs *Main> enableGUI >> main This is what I get instead of a working program: 2013-01-14 00:21:03.021 ghc[13403:1303] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-945.11/Misc.subproj/NSUndoManager.m:328 2013-01-14 00:21:03.022 ghc[13403:1303] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 2013-01-14 00:21:03