How to declare kUIOptionDisableProcessSwitch

I want to block the switch of apps with command + tab.

I know how to declare SetSystemUIMode to hide the dock
but I have no idea what to enter for kUIOptionDisableProcessSwitch.

Declare Function SetSystemUIMode Lib “Cocoa” (inMode as Integer, inOptions as Integer) as Integer

Var OSError as Integer
Const kUIModeContentHidden = 2
OSError = SetSystemUIMode(kUIModeContentHidden, 0)

I believe what you’re supposed to be using is this:

Which would translate to:

Declare Sub setPresntationOptions Lib "AppKit" Selector "setPresentationOptions:" (obj as Ptr, mode as Integer)

But you’ll also need the declare for sharedInstance to get the pointer to you app to pass into the obj item.

These options are a bit mask, so for instance:

NSApplicationPresentationHideDock = (1 << 1)

Means 1 bit shifted left 1 position, which equals 2.

You’ll need to get the value that the application currently has and then use a bitwise OR to add this value before setting it again.

Declare Function PresntationOptions Lib "AppKit" Selector "presentationOptions" (obj as Ptr) as Integer

Sorry, you were looking for:

NSApplicationPresentationDisableProcessSwitching = (1 << 5)

1 bitshift left 5 = 32

Make sure you read the overview section of this page to see what values can and must be used together. Otherwise your app will crash.