Mac OS X Declare novice.. help please

Hi All,
I am not at all good with using declares and need some help using Cocoa function - windowNumberAtPoint.

Here is my declare;

Declare Function windowNumberAtPoint Lib “Cocoa” Selector “windowNumberAtPoint:” (point As NSPoint, belowWindowWithWindowNumber As Integer) As Integer

I’ve defined a structure for NSPoint
X As Single
Y As Single

And calling it here;
Dim point As NSPoint
point.X = 100
point.Y = 150

Dim winNumber As Integer = windowNumberAtPoint(point, 0)

The code always returns 0 as the window number regardless of what window is under that mouse location.
I am guessing that I’ve not declared it correctly.

Any help is gratefully received

Look for (macoslib). It is a good reference for declares.
try this:

[code] Soft Declare Function NSClassFromString Lib “Cocoa” (aClassName As CFStringRef) As Ptr
declare function windowNumberAtPoint lib “Cocoa” selector “windowNumberAtPoint:belowWindowWithWindowNumber:” _
(class_id as Ptr, point as NSPoint, windowNumber as Integer) as Integer

Dim NSWindowRef As Ptr = NSClassFromString(“NSWindow”)

Dim point As NSPoint
point.X = 100
point.Y = 150

System.Log System.LogLevelError, "Ref: "+ str(windowNumberAtPoint(NSWindowRef, point, 0))
[/code]

Thank you very much Thomas
Great reference and the code works perfectly for me.

Kind regards