使用 JNA (Java) 进行 Windows 缩略图预览
W32API.HWND targetHwnd = User32.INSTANCE.FindWindow("SunAwtFrame", "Frame")
W32API.HWND sourceHwnd = User32.INSTANCE.FindWindow("triuiScreen", "EVE")
W32API.HANDLE thumbnailH = new W32API.HANDLE()
NativeLibrary dwm = NativeLibrary.getInstance("dwmapi")
dwm.getFunction('DwmRegisterThumbnail').invoke(targetHwnd, sourceHwnd, thumbnailH)
让我
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x70f34bee, pid=7208, tid=7364
#
# JRE version: 6.0_18-b07
# Java VM: Java HotSpot(TM) Client VM (16.0-b13 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [DWMAPI.DLL+0x4bee]
有一种感觉,我做得完全错误,但深入文档却一无所获。
W32API.HWND targetHwnd = User32.INSTANCE.FindWindow("SunAwtFrame", "Frame")
W32API.HWND sourceHwnd = User32.INSTANCE.FindWindow("triuiScreen", "EVE")
W32API.HANDLE thumbnailH = new W32API.HANDLE()
NativeLibrary dwm = NativeLibrary.getInstance("dwmapi")
dwm.getFunction('DwmRegisterThumbnail').invoke(targetHwnd, sourceHwnd, thumbnailH)
gives me
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x70f34bee, pid=7208, tid=7364
#
# JRE version: 6.0_18-b07
# Java VM: Java HotSpot(TM) Client VM (16.0-b13 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [DWMAPI.DLL+0x4bee]
I have a feeling I'm doing it completely wrong, but digging in documentation got me nowhere.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第三个参数是“out”参数,并且需要是指向句柄的指针,而不是句柄本身。所以,像
The 3rd param is an "out" parameter, and needs to be a pointer to the handle, not the handle itself. So, something like