PDA

View Full Version : filterout the Alt+Ctrl+Del



sudhansu
24th March 2010, 14:29
Hi All
In my application, One system is is connect to another system (Client server type application.) I can lock the client the client from master side. If client is locked then a widget is displayed in client side. whicjh should grab all keyboard and mouse event. current all key board event are filrterout excep ALT+CTRL+DEl. inorder to do it i did like following


void CLockWidget::keyPressEvent(QKeyEvent *i_KeyEvent)
{
//const QKeyEvent *keyEv = static_cast<QKeyEvent *>(i_Event);

if(i_KeyEvent->key() == Qt::Key_Delete)
{
i_KeyEvent->ignore();
}
else if(i_KeyEvent->key() == Qt::Key_Alt)
{
i_KeyEvent->ignore();
}
else if(i_KeyEvent->key() == Qt::Key_Control)
{
i_KeyEvent->ignore();
}
}


But its not filtering out. How to it.

toutarrive
24th March 2010, 14:54
What do your want to intercept the Ctrl+Alt+Del sequence for?
Ctrl+Alt+Del is designed to be handle by the system, and it doesn't sound a good idea to substitute yourself to the OS.

toutarrive
24th March 2010, 22:22
Anyway, you can't do it at Qt level, you've got to use Win API.


SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);


Have look at :http://www.qtcentre.org/threads/25296-disable-ALT-CTRL-DEL!!!! and http://msdn.microsoft.com/en-us/library/ms724947%28VS.85%29.aspx

squidge
24th March 2010, 22:26
Judging from his profile, it would seem that the OP wants it for Unix/X11, not Windows, in which case, comment out the line in /etc/inittab

toutarrive
24th March 2010, 22:38
Well spotted ... Should read profile more carefully.
Sorry for that.

sudhansu
25th March 2010, 05:36
Judging from his profile, it would seem that the OP wants it for Unix/X11, not Windows, in which case, comment out the line in /etc/inittab

Yes fatjuicymole, I need to do it in Linux (using Qt). Can you plz tell me how to do in which case, comment out the line in /etc/inittab through coding?.

squidge
25th March 2010, 07:55
If your app is running as a typical user (non-root), then you can't.

If it's SUID root then you can use reboot() api to modify ctrl-alt-del behavior.

Another alternative is to modify /etc/initab to check for the presence of a file or pipe before allowing the operation, and then control that file or pipe from your application.