objc
objc copied to clipboard
how convert nativeWindowHandle to NSView
I want to convert nativeWindowHandle to NSView, like
const myView = win.getNativeWindowHandle()
$.myFramework.setView(myView)
any suggestion?
where are you getting the native window handle from?
I use electron
have you tried objc.wrap
?
const viewObject = objc.wrap(win.getNativeWindowHandle());
I have tried, but objc can not receive NSView, It will be Buffer? not NSView?
I know this is two years later, but any updates on this? It would be nice if I could use this library with electron to do some simple operations on NSWindow. If i try to run let nativeWindow = objc.wrap(screenshotWindow.getNativeWindowHandle())
objc spits out the ambiguous error: Attempt to use unknown class 0x7fd84748ea30
.
Came here because I was also trying to figure this out and Google lead me here. I did end up figuring it out: you need to call .readPointer()
on the buffer returned from getNativeWindowHandle()
, e.g.
const handle = mainWindow.getNativeWindowHandle().readPointer()
const nsview = objc.wrap(handle)
nsview.window().invalidateShadow()
wrap
Have you resolve this problem? thanks
Have you resolve this problem? thanks
readPointer
when I run the programe, it show error: readPointer is not a function