Use a timer with a period of 17 (which equates approximately to one tick) which monitors System.MouseX and System.MouseY. When the mouse crosses the edge of the window, use this to bring the app to the front :
declare function NSClassFromString lib "Cocoa" ( inName as CFStringRef ) as Ptr
declare function sharedApplication lib "Cocoa" selector "sharedApplication" ( classRef as Ptr ) as Ptr
Dim myApplication as Ptr = sharedApplication( NSClassFromString( "NSApplication" ) )
declare sub activateIgnoringOtherApps lib "Cocoa" selector "activateIgnoringOtherApps:" ( appRef as Ptr, flag as boolean )
activateIgnoringOtherApps( myApplication, True )
me.AcceptFocus = True
me.UseFocusRing = True
me.SetFocus
I picked up that code from a post of Axel Schneider.