如何在C ++中实现CTRL-A组合键

时间:2022-05-27 22:23:35

I want to implement some action when CTRL-A is pressed . How can I do this in C++ on Windows Platform . I am using VS 2005 .

我想在按下CTRL-A时执行一些操作。如何在Windows平台上的C ++中执行此操作。我正在使用VS 2005。

Any pointers will help.

任何指针都会有所帮助。

2 个解决方案

#1


You need to define a Keyboard Accelerator table in your resources, and then make sure you call TranslateAccelerator in your message loop. See MSDN for full details.

您需要在资源中定义键盘加速器表,然后确保在消息循环中调用TranslateAccelerator。有关详细信息,请参阅MSDN。

If you're using a framework (eg. MFC) then it will have its own way of wrapping accelerators - you need to look them up in the documentation of the framework you're using.

如果您正在使用框架(例如MFC),那么它将有自己的包装加速器的方式 - 您需要在您正在使用的框架的文档中查找它们。

#2


You absolutely don't need accelerator and above code has no sense at all.
Simply use HK. See MSDN and Google groups for basic code (Win32)

你绝对不需要加速器,上面的代码完全没有意义。只需使用香港。有关基本代码,请参阅MSDN和Google网上论坛(Win32)

#1


You need to define a Keyboard Accelerator table in your resources, and then make sure you call TranslateAccelerator in your message loop. See MSDN for full details.

您需要在资源中定义键盘加速器表,然后确保在消息循环中调用TranslateAccelerator。有关详细信息,请参阅MSDN。

If you're using a framework (eg. MFC) then it will have its own way of wrapping accelerators - you need to look them up in the documentation of the framework you're using.

如果您正在使用框架(例如MFC),那么它将有自己的包装加速器的方式 - 您需要在您正在使用的框架的文档中查找它们。

#2


You absolutely don't need accelerator and above code has no sense at all.
Simply use HK. See MSDN and Google groups for basic code (Win32)

你绝对不需要加速器,上面的代码完全没有意义。只需使用香港。有关基本代码,请参阅MSDN和Google网上论坛(Win32)