Example #1
0
void CHotkeyDialog::OnBnClickedOk()
{
	UINT mod, vkey;

	CString modifierstring;
	modifier.GetLBText(modifier.GetCurSel(),modifierstring);
	CString vkeystr;
	vchar.GetLBText(vchar.GetCurSel(),vkeystr);
	mod = szKeyToIdent(modifierstring);
	vkey = szKeyToIdent(vkeystr);

	UnregisterHotKey(AfxGetMainWnd()->GetSafeHwnd(), 100);
	BOOL m_isKeyRegistered = RegisterHotKey(AfxGetMainWnd()->GetSafeHwnd(), 100,
	mod, vkey);

	CLaunchyDlg* main_dlg = (CLaunchyDlg*) AfxGetMainWnd();

	if (!m_isKeyRegistered) {
		AfxMessageBox(_T("Sorry, this hotkey will not work, please choose another"));
		// ReRegister the old hot key
		UnregisterHotKey(AfxGetMainWnd()->GetSafeHwnd(), 100);
		BOOL m_isKeyRegistered = RegisterHotKey(AfxGetMainWnd()->GetSafeHwnd(), 100,
		main_dlg->options->mod_key, main_dlg->options->vkey);
	}
	else {
		// Save the new hot key to ini
		main_dlg->options->vkey = vkey;
		main_dlg->options->mod_key = mod;
		OnOK();
	}
}
Example #2
0
void CPpcMainWnd::UnregisterHotKeys()
{
	if (!m_fHotKey)
		return;

	int i, j;
	if (m_fHold) {
		for (i = 0; i < sizeof(s_uHoldKeys) / sizeof(UINT) / 2; i++)
			UnregisterHotKey(m_hWnd, s_uHoldKeys[i][0]);

		CPpcOptions* pOptions = (CPpcOptions*)m_pOptions;
		for (i = 0; i < pOptions->m_listKeyMap.GetCount(); i++) {
			BOOL fHold = FALSE;
			ACCEL* p = (ACCEL*)pOptions->m_listKeyMap.GetAt(i);
			for (j = 0; j < sizeof(s_uHoldKeys) / sizeof(UINT) / 2; j++) {
				if (s_uHoldKeys[j][0] == p->key) {
					fHold = TRUE;
					break;
				}
			}

			if (!fHold) UnregisterHotKey(m_hWnd, p->key);
		}
	}
	else {
		CPpcOptions* pOptions = (CPpcOptions*)m_pOptions;
		for (i = 0; i < pOptions->m_listKeyMap.GetCount(); i++) {
			ACCEL* p = (ACCEL*)pOptions->m_listKeyMap.GetAt(i);
			UnregisterHotKey(m_hWnd, p->key);
		}
	}
	m_fHotKey = FALSE;
}
Example #3
0
wxZRColaFrame::~wxZRColaFrame()
{
    // Unregister global hotkey(s).
    UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
    UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);

#if defined(__WXMSW__)
    if (m_tfSource) {
        m_tfSource->UnadviseSink(m_dwCookie);
        m_tfSource->Release();
    }
#endif

    if (m_chrReq)
        delete m_chrReq;

    if (m_chrSelect)
        delete m_chrSelect;

    if (m_settings)
        delete m_settings;

    if (m_taskBarIcon) {
        m_taskBarIcon->Disconnect(wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEventHandler(wxZRColaFrame::OnTaskbarIconClick), NULL, this);
        delete m_taskBarIcon;
    }
}
Example #4
0
void UninitPasteSerial()
{
  bInitPasteSerial=FALSE;

  if (nHotkeyDelimSkipID)
  {
    if (UnregisterHotKey(hMainWnd, nHotkeyDelimSkipID))
    {
      GlobalDeleteAtom(nHotkeyDelimSkipID);
      nHotkeyDelimSkipID=0;
    }
  }
  if (nHotkeyDelimAsTabID)
  {
    if (UnregisterHotKey(hMainWnd, nHotkeyDelimAsTabID))
    {
      GlobalDeleteAtom(nHotkeyDelimAsTabID);
      nHotkeyDelimAsTabID=0;
    }
  }
  if (nHotkeyDelimAsIsID)
  {
    if (UnregisterHotKey(hMainWnd, nHotkeyDelimAsIsID))
    {
      GlobalDeleteAtom(nHotkeyDelimAsIsID);
      nHotkeyDelimAsIsID=0;
    }
  }
}
Example #5
0
static void Win_EnableAltTab( void ) {
    if( win.alttab_disabled ) {
        UnregisterHotKey( 0, 0 );
        UnregisterHotKey( 0, 1 );
        win.alttab_disabled = qfalse;
    }
}
Example #6
0
/* Thread safe - doesn't care about the lock */	
int HotkeysUnregister(HWND hwnd) {
	if(!(UnregisterHotKey(hwnd, 443)))
		debuglog(DEBUG_ERROR,"Failed unregistering manual sync hotkey\n");
		
	if(!(UnregisterHotKey(hwnd, 444)))
		debuglog(DEBUG_ERROR,"Failed unregistering mode switch hotkey\n");	
	
	return 1;
}
Example #7
0
static VOID
sRemoveHotKeys (HWND hwnd)
{
	UnregisterHotKey (hwnd, kPurgePassphraseCache);
	UnregisterHotKey (hwnd, kEncryptCurrentWindow);
	UnregisterHotKey (hwnd, kSignCurrentWindow);
	UnregisterHotKey (hwnd, kEncryptSignCurrentWindow);
	UnregisterHotKey (hwnd, kDecryptCurrentWindow);
///	UnregisterHotKey (hwnd, kUnmountPGPDisks);
}
Example #8
0
static void OnCreate(HWND hWnd) {
	UnregisterHotKey(HMain, HotKeyID);

	UnregisterHotKey(hWnd, HotKeyID);
	RegisterHotKey(hWnd, HotKeyID, MOD_WIN, Config.TaskListHWKey);

	SetTimer(hWnd, AltTabTimer, Config.AltTabTimeout, NULL);

	SetCapture(hWnd);

	AltTabPrgIdx = 1;
}
Example #9
0
static void OnDestroy(HWND hwnd)
{
	UnregisterHotKey(hwnd, 0);
	UnregisterHotKey(hwnd, 1);
	
#if ENABLE_HOOK
	Unhook();	
	#endif
	Shell_NotifyIcon(NIM_DELETE, &g_Notify);
	DestroyMenu(g_AppMenu);
	if(g_ImageList) delete g_ImageList;
	DeleteObject(g_NormalFont);
	DeleteObject(g_LaunchFont);
}
Example #10
0
static
BOOL
UnregisterHotKeys(
    IN PWLSESSION Session,
    IN HWND hwndSAS)
{
    /* Unregister hotkeys */
    UnregisterHotKey(hwndSAS, HK_CTRL_ALT_DEL);

    if (Session->TaskManHotkey)
        UnregisterHotKey(hwndSAS, HK_CTRL_SHIFT_ESC);

    return TRUE;
}
void CBacnetProgramEdit::OnClose()
{
	// TODO: Add your message handler code here and/or call default
	UnregisterHotKey(GetSafeHwnd(),KEY_F2);//注销F2键
	UnregisterHotKey(GetSafeHwnd(),KEY_F3);
	UnregisterHotKey(GetSafeHwnd(),KEY_F7);
	UnregisterHotKey(GetSafeHwnd(),KEY_F6);
	UnregisterHotKey(GetSafeHwnd(),KEY_F8);

	g_hwnd_now = mParent_Hwnd;
	if(m_pragram_dlg_hwnd!=NULL)
		::PostMessage(m_pragram_dlg_hwnd,WM_REFRESH_BAC_PROGRAM_LIST,NULL,NULL);
	CDialogEx::OnClose();
}
Example #12
0
/*
	ホットキー設定
*/
BOOL SetHotKey(Cfg *cfg)
{
    if (cfg->HotKeyCheck)
    {
        RegisterHotKey(GetMainWnd(), WM_SENDDLG_OPEN, cfg->HotKeyModify, cfg->HotKeySend);
        RegisterHotKey(GetMainWnd(), WM_RECVDLG_OPEN, cfg->HotKeyModify, cfg->HotKeyRecv);
        RegisterHotKey(GetMainWnd(), WM_DELMISCDLG, cfg->HotKeyModify, cfg->HotKeyMisc);
    }
    else {
        UnregisterHotKey(GetMainWnd(), WM_SENDDLG_OPEN);
        UnregisterHotKey(GetMainWnd(), WM_RECVDLG_OPEN);
        UnregisterHotKey(GetMainWnd(), WM_DELMISCDLG);
    }
    return	TRUE;
}
Example #13
0
static BOOL
Engine_Activate(TSEngine engine)
{
	switch (engine) {
	default:
		assert(FALSE);
		return FALSE;

	case TSEngine_NONE:
		return TRUE;

	case TSEngine_SIMPLE:
		if (!RegisterHotKey(g_TSWindow, IDHK_NEXT, MOD_ALT, g_HotKey))
			goto E1;
		if (!RegisterHotKey( g_TSWindow, IDHK_PREV,
		                     MOD_ALT|MOD_SHIFT, g_HotKey ))
			goto E2;
		return TRUE;
	E2:
		UnregisterHotKey(g_TSWindow, IDHK_NEXT);
	E1:
		return FALSE;

	case TSEngine_HOOK: {
		HINSTANCE hinstance;

		hinstance = (HINSTANCE)GetWindowLongPtr( g_TSWindow,
		                                         GWLP_HINSTANCE );
		g_HKeyHook = SetWindowsHookEx( WH_KEYBOARD_LL,
		                               TS_LowLevelKeyboardProc,
		                               hinstance, 0 );
		if (g_HKeyHook == NULL)
			goto E3;
		if (!RegisterHotKey(g_TSWindow, IDHK_NEXT, MOD_ALT, g_HotKey))
			goto E4;
		if (!RegisterHotKey( g_TSWindow, IDHK_PREV,
		                     MOD_ALT|MOD_SHIFT, g_HotKey ))
			goto E5;
		return TRUE;
	E5:
		UnregisterHotKey(g_TSWindow, IDHK_NEXT);
	E4:
		UnhookWindowsHookEx(g_HKeyHook);
	E3:
		return FALSE;
		}
	}
}
Example #14
0
//退出监控
void CKillGamesDlg::OnButton5() 
{
	BOOL m_isKeyRegistered = UnregisterHotKey(GetSafeHwnd(),m_nHotKeyID);
	ASSERT(m_isKeyRegistered != FALSE);
	CDialog::OnClose();
	CDialog::OnCancel();
}
Example #15
0
void ATMainWindow_c::DoRegisterHotKey()
{
#ifdef _WIN32
	UnregisterHotKey( winId(), EZ_HOTKEY );

	if ( m_bHotkeyEnabled )
	{
		int iModifier = 0;
		int iKey = 0;

		if ( m_strHotkeyMod1 == "Ctrl" )	iModifier |= MOD_CONTROL;
		if ( m_strHotkeyMod1 == "Alt" )		iModifier |= MOD_ALT;
		if ( m_strHotkeyMod2 == "Shift" )	iModifier |= MOD_SHIFT;

		if ( !m_strHotkeyKey.isEmpty() )
		{
			iKey = m_strHotkeyKey.toUpper().at( 0 ).toLatin1();
			if ( iKey < 'A' || iKey > 'Z' ) iKey = 0;
		}

		if ( iModifier && iKey )
			RegisterHotKey( winId(), EZ_HOTKEY, iModifier, iKey );
	}
#endif
}
Example #16
0
CTradeStockBaseDlg::~CTradeStockBaseDlg()
{
	UnRequestHQ();
	UnregisterHotKey(HOTKEY_ENTRUST_ID, 0, VK_F3);
	if (m_bQuickTrade)
	   UnregisterLinkageMsg(PUBLIC_MESSAGE_QUICKTRADE);
	UnregisterLinkageMsg(PUBLIC_MESSAGE_TRADE);
	UnregisterLinkageMsg(TRADE_MESSAGE_STOCKCODE);
	if (m_pTradeMarketList)
	{
		m_pTradeMarketList->Release();
	}
	if (m_pSHSJType)
	{
		m_pSHSJType->Release();
	}
	if (m_pSZSJType)
	{
		m_pSZSJType->Release();
	}
	if (m_StockEntrustType)
	{
		m_StockEntrustType->Release();
	}
}
Example #17
0
bool CHotKeysToCmdRouter::UnregisterCommand(UINT i_command_id)
{
 bool result = true;
 bool is_command_exist = false;
 if (NULL==mp_OriginalWnd)
 {
  _ASSERTE(0);
  return false;
 }

 //ID-шек c кодом i_command_id в базе данных может быть больше одной, поэтому нам нужен цикл
 HotKeyMap::iterator it;
 while((it = _FindCommandID(i_command_id)) != m_hot_key_map.end()) 
 {
  is_command_exist = true;
  //нашли ID-шку в базе данных. Надо снять с регистрации горячую клавишу
  if (!UnregisterHotKey(mp_OriginalWnd->m_hWnd, (*it).first))
   result = false;
  if (GlobalDeleteAtom((*it).first) != 0)
   result = false;

  //удаляем из базы данных
  m_hot_key_map.erase(it);  
 }

 //если были ошибки или команды нет в базе данных, то возвращаем false.
 return result && is_command_exist;
}
Example #18
0
// Method called when the timer has been edited
void Timer::setNewData(int period, QKeySequence keySequence, UINT modifiers, UINT virtualKey, int hotkeyId)
{
    // First, try to register the new hotkey if needed
    if ((this->virtualKey != virtualKey) || (this->modifiers != modifiers)) {
        if (!RegisterHotKey(nullptr, hotkeyId, modifiers | getNoRepeatFlag(), virtualKey)) {
            throw SMException(tr("failed to register the hotkey. No modification done."));
        }
        UnregisterHotKey(nullptr, this->hotkeyId);
        this->hotkeyId = hotkeyId;
    }

    // Stop the timer if it's currently active
    bool active = this->timer->isActive();
    stop();

    // Update timer's data
    timer->setInterval(period * 1000);
    this->period      = period;
    this->keySequence = keySequence;
    this->modifiers   = modifiers;
    this->virtualKey  = virtualKey;

    // Enable the timer if it was previously active
    if (active) {
        play();
    }
}
Example #19
0
void CGrabKeyDlg::OnDestroy() {
	for (int i = 0xc1; i <= 0xcf; i++) {
		UnregisterHotKey(GetSafeHwnd(), i);
	}

	CDialog::OnDestroy();
}
Example #20
0
DWORD WINAPI YAMNHotKeyThread(LPVOID Param)
{
	MSG WinMessage;
	WORD HotKey = LOWORD(Param);
	int HotKeyID;

//	register hotkey for main YAMN thread first 
	if(!(HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtom(YAMN_HKCHECKMAIL),HIBYTE(HotKey),LOBYTE(HotKey))))
		return 0;

	while(1)
	{
		GetMessage(&WinMessage,NULL,WM_HOTKEY,WM_YAMN_CHANGEHOTKEY);

//	if we want to close miranda, we get event and do not run pop3 checking anymore
		if(WAIT_OBJECT_0==WaitForSingleObject(ExitEV,0))
			break;

		switch(WinMessage.message)
		{
//	user pressed hotkey
			case WM_HOTKEY:
				ForceCheckSvc((WPARAM)0,(LPARAM)0);
				break;
//	hotkey changed
			case WM_YAMN_CHANGEHOTKEY:
				UnregisterHotKey(NULL,HotKeyID);
				HotKeyID=RegisterHotKey(NULL,(int)GlobalAddAtom(YAMN_HKCHECKMAIL),WinMessage.wParam,WinMessage.lParam);
				break;
		}
	}
	return 1;
}
Example #21
0
char _check_hotkeys(
		HWND  hwnd,
		DWORD hotkeys[ ]
	)
{
	wchar_t display[400];
	wchar_t key[200];
	int     k = 0;
	int     j;	

	for ( ; k < HOTKEYS; k++ ) 
	{
		for ( j = 0; j < HOTKEYS; j++ )
		{
			if ( k != j && hotkeys[k] && hotkeys[k] == hotkeys[j] )
			{
				_key_name( HIWORD(hotkeys[k]), LOWORD(hotkeys[k]), key );
				_snwprintf( display, sizeof_w(display), L"Duplicated Hotkey: \"%s\"", key );

				MessageBox( hwnd, display, L"Error", MB_OK | MB_ICONERROR );
				return FALSE;
			}
		}
		if ( hotkeys[k] && !RegisterHotKey( __dlg, k, LOWORD(hotkeys[k]), HIWORD(hotkeys[k]) ) ) 
		{
			_key_name( HIWORD(hotkeys[k]), LOWORD(hotkeys[k]), key );
			return FALSE;
		} else {
			UnregisterHotKey( __dlg, k );
		}
	}

	return TRUE;

}
Example #22
0
void Hotkey::stop_scan()
{
	if (ScanHotkeyRegistered) {
		UnregisterHotKey(ServerWND, ScanHotKeyId - 0xC000);
		ScanHotkeyRegistered = false;
	}
}
Example #23
0
void Hotkey::stop_mainwindow()
{
	if (MainWindowHotkeyRegistered) {
		UnregisterHotKey(ServerWND, MainWindowHotKeyId - 0xC000);
		MainWindowHotkeyRegistered = false;
	}
}
Example #24
0
//Производит регистрацию/антиригистрацию всех горячих клавиш указанного роутера.
//i_register - если true, то регистрация, иначе антирегистрация
bool HotKeysManager::RegisterOneRouter(CHotKeysToCmdRouter* ip_router, bool i_register)
{
 bool result = true;
 bool is_command_exist = false;
 if (NULL==ip_router || NULL==ip_router->mp_OriginalWnd)
 {
  ASSERT(0);
  return false;
 }

 CHotKeysToCmdRouter::HotKeyMap::iterator it;
 for(it = ip_router->m_hot_key_map.begin(); it != ip_router->m_hot_key_map.end(); ++it)
 {
  if (!i_register)
  {
   if (UnregisterHotKey(ip_router->mp_OriginalWnd->m_hWnd, (*it).first))
    result = false;
  }
  else
  {
   BOOL status = RegisterHotKey(ip_router->mp_OriginalWnd->m_hWnd, (*it).first, (*it).second.m_fsModifiers, (*it).second.m_vk);
   result = status ? true : false;
  }
 }

 return result;
}
Example #25
0
static void virgo_toggle_hotkeys(Virgo *v)
{
	unsigned i;
	v->handle_hotkeys = !v->handle_hotkeys;
	if (v->handle_hotkeys) {
		for (i=0; i<NUM_DESKTOPS; i++) {
			register_hotkey(i*2, MOD_ALT|MOD_NOREPEAT, i+1+'0');
			register_hotkey(i*2+1, MOD_CONTROL|MOD_NOREPEAT, i+1+'0');
		}
	} else {
		for (i=0; i<NUM_DESKTOPS; i++) {
			UnregisterHotKey(NULL, i*2);
			UnregisterHotKey(NULL, i*2+1);
		}
	}
}
void CBacnetProgram::OnClose()
{
	// TODO: Add your message handler code here and/or call default
	UnregisterHotKey(GetSafeHwnd(),KEY_INSERT);
	::PostMessage(BacNet_hwd,WM_DELETE_NEW_MESSAGE_DLG,DELETE_WINDOW_MSG,0);
	CDialogEx::OnClose();
}
Example #27
0
void Ctrl::UnregisterSystemHotKey(int id)
{
	if(id >= 0 && id < hotkey.GetCount()) {
		UnregisterHotKey(NULL, id);
		hotkey[id].Clear();
	}
}
Example #28
0
void Ctrl::ExitWin32()
{
	RenderAllFormats();

	OleUninitialize();

	sFinished = true;
	
	for(int i = 0; i < hotkey.GetCount(); i++)
		if(hotkey[i])
			UnregisterHotKey(NULL, i);
	
	for(int i = 0; i < Windows().GetCount(); i++) {
		HWND hwnd = Windows().GetKey(i);
		if(hwnd)
			::DestroyWindow(hwnd);
	}
	MSG msg;
	while(PeekMsg(msg))
		if(msg.message != WM_QUIT)
			::PostQuitMessage(0);
#ifndef flagDLL
#ifndef PLATFORM_WINCE
	ELOG("ExitWin32 1");
	OverwatchEndSession.Set();
	ELOG("ExitWin32 2");
	PostMessage(OverwatchHWND, WM_USER, 0, 0);
	ELOG("ExitWin32 3");
	LLOG("Waiting for overwatch thread to finish...");
	WaitForSingleObject(OverwatchThread, INFINITE);
	ELOG("ExitWin32 4");
	LLOG("...overwatch thread finished");
#endif
#endif
}
Example #29
0
void MainWindow::setNewSettings(bool use, bool media, bool cache, QString path, bool minTray)
{
    qDebug()<<use<<" "<<media<<" "<<cache<<" "<<path<<" "<<minTray;
#ifdef WIN32
    UnregisterHotKey((HWND)winId(),66613);
    UnregisterHotKey((HWND)winId(),66612);
    UnregisterHotKey((HWND)winId(),66611);
#endif
#ifdef Q_OS_LINUX

#endif
    useHotkeys = use;
    useMediaHotkeys = media;
    useCache = cache;
    minToTray = minTray;
    saveSettings();
    emit setPrefWindowsHotkeysUi(useHotkeys, useMediaHotkeys);
    emit setMinToTray(minToTray);
    if (useHotkeys)
    {
        if (useMediaHotkeys)
        {
#ifdef WIN32
            RegisterHotKey((HWND)winId(),66613, 0, VK_MEDIA_NEXT_TRACK);
            RegisterHotKey((HWND)winId(),66612, 0, VK_MEDIA_PREV_TRACK);
            RegisterHotKey((HWND)winId(),66611, 0, VK_MEDIA_PLAY_PAUSE);
            qDebug()<<"Registered media hotkeys";
#endif
#ifdef Q_OS_LINUX

#endif
        }
        else
        {
#ifdef WIN32
            RegisterHotKey((HWND)winId(),66613, MOD_CONTROL, VK_RIGHT);
            RegisterHotKey((HWND)winId(),66612, MOD_CONTROL, VK_LEFT);
            RegisterHotKey((HWND)winId(),66611, MOD_CONTROL, VK_DOWN);
            qDebug()<<"Registered desktop hotkeys";
#endif
#ifdef Q_OS_LINUX

#endif
        }
    }
}
Example #30
0
GlobalKey::~GlobalKey()
{
    QWidget *main = ShortcutsPlugin::getMainWindow();
    if (m_key && main){
        UnregisterHotKey(main->winId(), m_key);
        DeleteAtom((unsigned short)m_key);
    }
}