View Full Version : disable ALT+CTRL+DEL!!!!
phillip_Qt
2nd November 2009, 05:03
Hi All
i need a help. I wrote an application to lock the keyboard and mouse input. Its working fine, but ALT+CTRL+DEL key is working i need to disable this also. can any body help me. Below i've posted the code.
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::lock()
{
QApplication::setOverrideCursor();
QWidget::grabMouse();
QWidget::grabKeyboard();
}
NB: i'm calling lock() inside main() function. Plz help me.
squidge
2nd November 2009, 08:46
ctrl-alt-del on windows is the "Secure attention sequence", so you can't filter it (Well, you could write a keyboard hook driver), but you can use a Windows API to disable it easily using SystemParametersInfo() :
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
phillip_Qt
2nd November 2009, 08:57
ctrl-alt-del on windows is the "Secure attention sequence", so you can't filter it (Well, you could write a keyboard hook driver), but you can use a Windows API to disable it easily using SystemParametersInfo() :
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
Thank you very much. But i need Qt methods. can u plz tell me how to do it? I'm writing this application in linux enviroment.
squidge
2nd November 2009, 14:43
Qt doesn't support such a feature. Maybe because it's Windows specific?
Corinzio
2nd November 2009, 17:03
I'm not sure but maybe you could install a filter on QEvent::keypress event
squidge
2nd November 2009, 19:20
You can't filter CTRL+ALT+DEL, as it's the sequence to ensure you are using an anthentic login prompt, rather than what could be a trojan prompt.
phillip_Qt
3rd November 2009, 04:27
I'm not sure but maybe you could install a filter on QEvent::keypress event
Thank you very much for reply.
I tried like this.
QEvent ev(QEvent::WindowBlocked);
ev.setAccepted(true);
But it is not working. Any other suggestion??
NoRulez
3rd November 2009, 08:36
You need to call the underlying WinAPI. If you need special things of an operating system you have to use the underlying OS API (Windows => WinAPI, Linux ..., Mac OS ...)
As fatjuicymole has already been written, use:
#if defined(Q_WS_WIN)
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
#endif
Best Regards
NoRulez
phillip_Qt
3rd November 2009, 08:39
You need to call the underlying WinAPI. If you need special things of an operating system you have to use the underlying OS API (Windows => WinAPI, Linux ..., Mac OS ...)
As fatjuicymole has already been written, use:
#if defined(Q_WS_WIN)
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
#endif
Best Regards
NoRulez
Thank u very much. But i'm writing this application for linux o/s. any thing in linux to disable alt+ctrl+del key press event?:(
NoRulez
3rd November 2009, 09:10
On linux you have to edit the file "/etc/inittab" and change from
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
to
# ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
After this you either boot the system or type on the console:
init q
This could also be done with QFile, QRegExp and QProcess
Best Regards
NoRulez
phillip_Qt
3rd November 2009, 09:23
On linux you have to edit the file "/etc/inittab" and change from
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
to
# ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
After this you either boot the system or type on the console:
init q
This could also be done with QFile, QRegExp and QProcess
Best Regards
NoRulez
Thank u NoRulez. I'll try in this way.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.