1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/newbeats-pastes

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
shortcut_win.cpp 544 Байты
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
JackieLiu Отправлено 16.10.2020 19:46 bdb4081
#include "shortcut.h"
#include <QtWin>
#include <winuser.h>
bool stoped;
ShortcutPrivate::ShortcutPrivate(QObject *parent) : QThread(parent)
{
this->start();
}
ShortcutPrivate::~ShortcutPrivate()
{
this->stop();
}
void ShortcutPrivate::run()
{
RegisterHotKey(NULL, 1, MOD_CONTROL, 0);
MSG msg;
::memset(&msg, 0, sizeof(MSG));
while ((GetMessage(&msg, NULL, 0, 0) != 0) && !stoped) {
if (msg.message == WM_HOTKEY) {
emit this->activated();
}
}
}
void ShortcutPrivate::stop()
{
stoped = true;
UnregisterHotKey(NULL, 1);
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/newbeats-pastes.git
git@api.gitlife.ru:oschina-mirror/newbeats-pastes.git
oschina-mirror
newbeats-pastes
newbeats-pastes
master