macos-carbon

Get a bounds of WindowRef?

a 夏天 提交于 2019-12-12 07:27:50
问题 I am trying to find a Carbon API which can give me the WindowRef from window id and with that windowref I want to have bounds? EDIT: I found API extern WindowRef HIWindowFromCGWindowID(CGWindowID inWindowID); But I am not able to use it. I have included carbon header and have also added its framework to project. Is there something else required to HI apis? Any help is appreciated. Thank you for your time. 回答1: Following should do - CGRect rect; uint32_t windowid[1] = {windowID}; CFArrayRef

Mac .pref File Hex Path

久未见 提交于 2019-12-11 22:24:13
问题 I'm trying to enter a file path into a few .pref files, but instead of a String, the field wants some sort of Hexadecimal sequence. How can I convert my path into this Hex format? Mac OS 10.6.7 Here is an example of a file location: <00000000 009e0003 00010000 c94bbb14 0000482b 00000000 000d3ad2 000dfc12 0000c950 e4db0000 00000920 fffe0000 00000000 0000ffff ffff0001 0008000d 3ad2000c 9ce1000e 000c0005 0069006e 0062006f 0078000f 001a000c 004d0061 00630069 006e0074 006f0073 00680020 00480044

Why is Xcode Giving Me These Errors?

喜欢而已 提交于 2019-12-11 18:03:02
问题 The error I get is Xcode saying 3 things are un-declared (see below picture) alt text http://snapplr.com/snap/ks4h But in the Header File I have declared them (see below picture) alt text http://snapplr.com/snap/htmb Why I am getting these errors when I have declared them. The Full Code: Header File. #import <Foundation/Foundation.h> @interface HotKeyController : NSObject { IBOutlet NSButton *cmdHK; IBOutlet NSButton *ctrHK; IBOutlet NSButton *optHK; IBOutlet NSPopUpButton *keyHK; IBOutlet

Find Window At Location Using Carbon And Carbon Problems In 64-Bit Applications

ⅰ亾dé卋堺 提交于 2019-12-11 15:39:05
问题 As I said in some questions today I´m looking for the way to get window or windowPart references at a certain location. Although I know I could use Cocoa for this purpose (I don´t know how to do it yet) I prefer (and probably need) to do this using Carbon because the entire application that needs this functionality is written in C++ but I´ve found many problems trying it. Does anyone get a valid windowPtr or windowRef using one of the following functions? FindWindow, MacFindWindow,

AEInstallEventHandler handler not being called on startup

匆匆过客 提交于 2019-12-11 10:24:13
问题 I've installed a Apple Event handler for URL's in my app: OSStatus e = AEInstallEventHandler( kInternetEventClass, kAEGetURL, NewAEEventHandlerUPP(AppleEventProc), (SRefCon)this, false); And that works if my application is running. However if my app is NOT running, clicking a URL in a browser starts the application but no Apple Event is received on my handler. My call to AEInstallEventHandler is during my app's startup phase, before it reaches the message loop. It's not the very first thing I

Application menu is enabled even if a modal dialog box is open

喜夏-厌秋 提交于 2019-12-11 08:13:59
问题 I have an application where I can launch a modal dialog box over a main window. The main window has some network activity going on in background which updates my background UI. Due to this the application menu becomes accessible even if the modal dialog is open. How can I avoid this? Any help is appreciated. I am using Mac, Qt, Carbon. 回答1: You can't disable Application menu on Mac OS X, it's always "active" BUT you can disable actions you don't want to be used while dialog is visible 回答2:

Why copy and paste in finder doesn't work when I use RegisterEventHotKey (Cocoa)?

a 夏天 提交于 2019-12-11 07:44:05
问题 I use function RegisterEventHotKey() and when I try registering Cmd + C or Cmd + V, I notice that copy and paste in finder doesn't work. I insert parameter inOptions = 0 to function RegisterEventHotKey() so it should non-exclusiv but why finder seem not to receive this hot key? EventTypeSpec eventType; eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; InstallApplicationEventHandler(&MyHotKeyHandler,1,&eventType,(void *)self,NULL); EventHotKeyID gMyHotKeyID;

Why does `#import <HIToolbox/Events.h>` fail?

为君一笑 提交于 2019-12-11 06:47:56
问题 I require kVK_Space which is in HIToolbox/Events.h : #import <Carbon/Carbon.h> works, and this file contains: #include <HIToolbox/HIToolbox.h> But if I try this second #include directly, it fails. Can anyone explain why? 回答1: Carbon is an "umbrella framework". It encapsulates other frameworks, such as HIToolbox. By design, to hide the implementation details, you can't directly include the headers of the subframeworks. From the above link: [T]wo factors distinguish umbrella frameworks from

Generate the hardware interupt which will enable the CapsLock

*爱你&永不变心* 提交于 2019-12-11 05:58:15
问题 I want to Send my machine an hardware event so that my caps-lock key becomes enable. When I send enable interrupt, light on Caps-lock key should be on and when I send enable interrupt, light on Caps-lock key should be off. I am using Qt, Mac, C++, Carbon. 回答1: No need for an interrupt. The Caps Lock, Num Lock, and Scroll Lock lights are programmatically controllable. Note that this won't actually turn the Caps Lock on (causing the user to enter all-capital text), but you shouldn't do that. If

Creating a main event loop (for hotkeys etc)

血红的双手。 提交于 2019-12-11 04:21:34
问题 I am trying to write a stand alone app to register a global hotkey. Below is my code which I compile with gcc -framework Foundation -framework AppKit -framework Carbon -lstdc++ namsg.mm -o namsg . I have put in a do { event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode: NSDefaultRunLoopMode dequeue:YES]; if (event != nil) { [self handleEvent:event]; } } while(true); however my hotkey of (Command + 3) is not picked up. This hotkey combination does work