Hello,
How to get the ID of the active window (WindowID)?
I tested this but always returns 0 !
Soft Declare Function NSClassFromString Lib "Cocoa" (className As CFStringRef) As Ptr
Soft Declare Function sharedApplication Lib "Cocoa" Selector "sharedApplication" (NSObjectClass As Ptr) As Ptr
Soft Declare Function mainWindow Lib "Cocoa" Selector "mainWindow" (NSApp As Ptr) As Ptr
Soft Declare Function windowNumber Lib "Cocoa" Selector "windowNumber" (NSWindow As Ptr) As Integer
Function GetActiveWindowID() As Integer
// Obtenez la classe NSApplication
Dim NSApplicationClass As Ptr = NSClassFromString("NSApplication")
// Get the shared instance of NSApplication
Dim NSApp As Ptr = sharedApplication(NSApplicationClass)
// Get the main application window
Dim NSMainWindow As Ptr = mainWindow(NSApp)
//Get the window number of the main window
Dim windowID As Integer = windowNumber(NSMainWindow)
// Return window ID
Return windowID
End Function
Thanks