如何使用jni处理系统菜单上的事件 [英] how to handle event on system menu using jni
本文介绍了如何使用jni处理系统菜单上的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Java的新手.我现在要在系统菜单上添加一个额外的菜单,我想处理java swings应用程序中系统菜单上的事件,我为此在c ++中准备了一个dll,但无法处理系统上的事件.如果有任何人帮助我执行此操作,请通过JNI使用wndproc方法通过dll进行菜单.
I am new to java .I add one extra menu on system menu now I want to handle an event on the system menu in java swings application i prepare a dll for that in c++ and i am unable to handle the event on system menu through dll using wndproc method through JNI if there any one who helps me to do this.
推荐答案
您将在此处找到JNI代码:
SWT:标准小工具工具包 [ ^ ]
我知道SWT不是Swing-但是SWT具有必需的JNI代码.
请记住,Swing建立在AWT的原始对象和框架之上.
在
You''ll find the JNI code here:
SWT: The Standard Widget Toolkit[^]
I know SWT is not Swing - but SWT has the required JNI code.
Remember that Swing is built on top of the original objects and framework of AWT.
Inside the
(JDK)\ include文件夹中,您会找到jabat.h
在
(JDK)\include folder you''ll find jawt.h
Inside the
(JDK)\ include \ win32内,您将找到jabat_md.h
limbt_Win32DrawingSurfaceInfo允许您访问本机窗口句柄.
尝试使用 SetWindowLongPtr [ Windows子类化并与C ++类挂钩 [ Jace [ ^ ]效果很好-简化了JNI开发.
最好的问候
Espen Harlinn
(JDK)\include\win32 you''ll find jawt_md.h
jawt_Win32DrawingSurfaceInfo allows you to access the native window handle.
Try subclassing the window using SetWindowLongPtr[^] with GWLP_WNDPROC
Here is an example:
Windows subclassing and hooking with C++ classes[^]
You''ll need to update the example code as shown in the comments by Member 3644181
I''ve found that Jace[^] works nicely - It eases JNI development.
Best regards
Espen Harlinn
这篇关于如何使用jni处理系统菜单上的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文