Results 1 to 11 of 11

Thread: disable ALT+CTRL+DEL!!!!

  1. #1
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default disable ALT+CTRL+DEL!!!!

    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.

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent), ui(new Ui::MainWindow)
    3. {
    4. ui->setupUi(this);
    5.  
    6. }
    7.  
    8. MainWindow::~MainWindow()
    9. {
    10. delete ui;
    11. }
    12.  
    13. void MainWindow::lock()
    14. {
    15. QApplication::setOverrideCursor();
    16. QWidget::grabMouse();
    17. QWidget::grabKeyboard();
    18.  
    19. }
    To copy to clipboard, switch view to plain text mode 

    NB: i'm calling lock() inside main() function. Plz help me.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    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() :

    Qt Code:
    1. SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    Quote Originally Posted by fatjuicymole View Post
    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() :

    Qt Code:
    1. SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
    To copy to clipboard, switch view to plain text mode 
    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.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    Qt doesn't support such a feature. Maybe because it's Windows specific?

  5. #5
    Join Date
    Nov 2008
    Location
    Italy
    Posts
    16
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    I'm not sure but maybe you could install a filter on QEvent::keypress event

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    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.

  7. #7
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    Quote Originally Posted by Corinzio View Post
    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.

    Qt Code:
    1. QEvent ev(QEvent::WindowBlocked);
    2. ev.setAccepted(true);
    To copy to clipboard, switch view to plain text mode 

    But it is not working. Any other suggestion??
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  8. #8
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Re: disable ALT+CTRL+DEL!!!!

    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:
    Qt Code:
    1. #if defined(Q_WS_WIN)
    2. SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
    3. #endif
    To copy to clipboard, switch view to plain text mode 

    Best Regards
    NoRulez

  9. #9
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    Quote Originally Posted by NoRulez View Post
    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:
    Qt Code:
    1. #if defined(Q_WS_WIN)
    2. SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &bOldState, 0);
    3. #endif
    To copy to clipboard, switch view to plain text mode 

    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?
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  10. #10
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Re: disable ALT+CTRL+DEL!!!!

    On linux you have to edit the file "/etc/inittab" and change from
    Qt Code:
    1. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
    To copy to clipboard, switch view to plain text mode 
    to
    Qt Code:
    1. # ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
    To copy to clipboard, switch view to plain text mode 

    After this you either boot the system or type on the console:
    Qt Code:
    1. init q
    To copy to clipboard, switch view to plain text mode 

    This could also be done with QFile, QRegExp and QProcess

    Best Regards
    NoRulez

  11. #11
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disable ALT+CTRL+DEL!!!!

    Quote Originally Posted by NoRulez View Post
    On linux you have to edit the file "/etc/inittab" and change from
    Qt Code:
    1. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
    To copy to clipboard, switch view to plain text mode 
    to
    Qt Code:
    1. # ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
    To copy to clipboard, switch view to plain text mode 

    After this you either boot the system or type on the console:
    Qt Code:
    1. init q
    To copy to clipboard, switch view to plain text mode 

    This could also be done with QFile, QRegExp and QProcess

    Best Regards
    NoRulez
    Thank u NoRulez. I'll try in this way.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

Similar Threads

  1. How to disable keyboard
    By garry_3peace in forum Newbie
    Replies: 9
    Last Post: 27th October 2009, 04:17
  2. how to disable OnItem drops in a QListView?
    By rgl in forum Qt Programming
    Replies: 2
    Last Post: 31st January 2009, 15:26
  3. How to disable NextButton in QWizard ?
    By litroncn in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2008, 07:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.