检测用户何时在带有打印屏幕的窗口中拍摄屏幕截图? [英] Detect when user takes a screen shot in windows with print screen?

查看:48
本文介绍了检测用户何时在带有打印屏幕的窗口中拍摄屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我需要在我的应用程序中检测用户何时使用打印屏幕键盘按钮在 Windows 中截取屏幕截图.我注意到 Picasa 这样做并通知用户,这在我的聊天软件中非常有用.即使窗口没有焦点,它也需要能够检测到它.有人知道我会怎么做吗?

So, I need to, in my application, detect when the user takes a screenshot in Windows by using the print screen keyboard button. I noticed that Picasa does this and notifies the user, this would be very useful in my chat software. It needs to be able to detect it even when the window doesnt have focus. Anyone know how I would do this?

提前致谢!

推荐答案

KeyEvent 类有一个名为 VK_PRINTSCREEN 的键代码,代表 PrintScreen 键...

The KeyEvent class has a key code called VK_PRINTSCREEN that represents the PrintScreen key...

要听它被按下,你会写一个像这样的keylistener......

To listen for it being pressed you would write a keylistener something like this...

public class PrintScrnListener implements KeyListener {  
    public void keyPressed( KeyEvent e ) {  
        if (e.getKeyCode() == KeyEvent.VK_PRINTSCREEN ) {  
            // Do whatever...  
        }  
    }  
    public void keyReleased( KeyEvent e ) {}  
    public void keyTyped( KeyEvent e ) {}  
}  

这篇关于检测用户何时在带有打印屏幕的窗口中拍摄屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆