开发者

interprocess communication

开发者 https://www.devze.com 2023-03-20 17:18 出处:网络
I wanted to know whether it is possible for my application written in java to monitor events(like click of f开发者_如何学Goile menu, or edit menu) in other third party applications such as in editors,

I wanted to know whether it is possible for my application written in java to monitor events(like click of f开发者_如何学Goile menu, or edit menu) in other third party applications such as in editors, office applications etc...

My application should run in the background and it should be able to capture and alter events of currently focused applications which may not be necessarily java applications.

For example: if a user clicks the file --> save as option in microsoft word then my application should be able to receive these two events and also be able to automate these events whenever necessary..

Please help

Thanks in advance


I've never done this in Java, but since you're dealing with Win32, I can at least suggest the native part. What you're looking for is hooking other processes on your system. For that, you'll have to write a native DLL. It's a common technique, and you'll easily find a lot of information about it. A good starting point would be Using Hooks from MSDN.

Once you inject the DLL into all other processes in the system, you'll have to figure out how to identify the ones you're actually interested in. How would you do that depends on what you're actually trying to do. To get a better understanding of what messages are sent on different actions, you can use Spy++ that comes with VS.

Lastly, you have to setup some communication between your native DLL and your Java program. This is the part I'm not familiar with: you will have to use JNI. Luckily, JNI is a well covered topic, and you can find a lot of suggestions in this very site.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号