locked
How to detect Ctrl+Alt+Del combination of keys pressed at a time using C# programming RRS feed

  • Question

  • Hi, I am working on a windows application. On my main form, ther are 8 panels, where we can render videos on those panels. Everything is working fine untill now. but when user press Ctrl+Alt+Delete keys and chose 'start task manager', the video lost is observed on all the panels and the CPU usage goes to 99%.

    We believe that there is a pblm with Video rendering and filter graphs. alternatively i did a trial and error....I handled the key press event for 'Ctrl' key and when the event fires I retsrted the filter graphs and the video comes again. this is working fine.
    But my question is i want to detect/handle combination of keys (Ctrl+Alt+Del) at a time, then only i want to restart the graphs.
    Anyone pls suggest me how to detect the combination of keys...Any Solution.

    
    Wednesday, November 7, 2012 9:06 AM

Answers

  • Hi,

    Taken from the thread Disable Ctrl+Alt+Del Combination on windows7 on StackOverflow:

    CTRL+ALT+DEL is the secure attention sequence of Windows NT (and its derivatives like Win7). It is the one key combination that is guaranteed to get the OS's attention. The whole point of the SAS is that it can't be intercepted or stopped by user programs.

    So, in short: you can't.

    Hope this helps


    Please mark the best replies as answers - Twitter: @rickvdbosch - Blog: http://bloggingabout.net/blogs/rick


    • Edited by Rick van den Bosch Wednesday, November 7, 2012 9:32 AM Fixed link
    • Proposed as answer by EmreAydemir Wednesday, November 7, 2012 1:01 PM
    • Marked as answer by Jason Dot Wang Thursday, November 15, 2012 3:27 AM
    Wednesday, November 7, 2012 9:18 AM
  • Hi,

    The link has been fixed.
    To catch the key combination, the article 'Trap CtrlAltDel; Hide Application in Task List on Win2000/XP' on codeproject might help. I do think however that this article also indicates it's an unsupported solution. It may not work on future versions of Windows (and the article is fairly old).

    There are stories of writing your own keyboard driver, but I guess that's a bit much...

    What are you trying to accomplish? Is there no (system) event that can help you?

    Hope this helps


    Please mark the best replies as answers - Twitter: @rickvdbosch - Blog: http://bloggingabout.net/blogs/rick

    • Proposed as answer by Jason Dot Wang Thursday, November 8, 2012 8:31 AM
    • Marked as answer by Jason Dot Wang Thursday, November 15, 2012 3:27 AM
    Wednesday, November 7, 2012 9:41 AM

All replies

  • Since this is a Window Reserved Key, You will have to write custom Key Hooks and use it.

    Hail .NET Mein Fuhrer

    Wednesday, November 7, 2012 9:10 AM
  • Hi Prateek, I have never written Key hooks in .Net. can you give more input how it can be done..?
    Wednesday, November 7, 2012 9:13 AM
  • Look at this. May be this Library can help.

    Hail .NET Mein Fuhrer

    Wednesday, November 7, 2012 9:14 AM
  • Wednesday, November 7, 2012 9:17 AM
  • Hi,

    Taken from the thread Disable Ctrl+Alt+Del Combination on windows7 on StackOverflow:

    CTRL+ALT+DEL is the secure attention sequence of Windows NT (and its derivatives like Win7). It is the one key combination that is guaranteed to get the OS's attention. The whole point of the SAS is that it can't be intercepted or stopped by user programs.

    So, in short: you can't.

    Hope this helps


    Please mark the best replies as answers - Twitter: @rickvdbosch - Blog: http://bloggingabout.net/blogs/rick


    • Edited by Rick van den Bosch Wednesday, November 7, 2012 9:32 AM Fixed link
    • Proposed as answer by EmreAydemir Wednesday, November 7, 2012 1:01 PM
    • Marked as answer by Jason Dot Wang Thursday, November 15, 2012 3:27 AM
    Wednesday, November 7, 2012 9:18 AM
  • Hi Rick,

    I dont want to stop or ignore the combination of key press, On these combination key press, i want to do some other action.

    by the way the above thread taken from StackOverflow is throwing error ..."Resource cannot be found."

    
    Wednesday, November 7, 2012 9:27 AM
  • Hi,

    The link has been fixed.
    To catch the key combination, the article 'Trap CtrlAltDel; Hide Application in Task List on Win2000/XP' on codeproject might help. I do think however that this article also indicates it's an unsupported solution. It may not work on future versions of Windows (and the article is fairly old).

    There are stories of writing your own keyboard driver, but I guess that's a bit much...

    What are you trying to accomplish? Is there no (system) event that can help you?

    Hope this helps


    Please mark the best replies as answers - Twitter: @rickvdbosch - Blog: http://bloggingabout.net/blogs/rick

    • Proposed as answer by Jason Dot Wang Thursday, November 8, 2012 8:31 AM
    • Marked as answer by Jason Dot Wang Thursday, November 15, 2012 3:27 AM
    Wednesday, November 7, 2012 9:41 AM
  • Thanks Rick, Basically i want to trap/detect Ctrl+Alt+Del press, when user press this combination, i want to retstart my Filter Graphs, which will reload the video.
    Wednesday, November 7, 2012 10:00 AM
  • well, it is not good advise to play around default window key combination, you may need to check things in broad scenarios. What if I right click on the menu bar and open task manager using mouse(no keyboards)?

    regards

    joon

    Wednesday, November 7, 2012 10:28 AM
  • Hi,

    This seems to work. I'm sure you can make a (background) loop so you can check for this periodicaly and act upon the starting of the Task Manager this way.

    Process[] processes;
    
    processes = Process.GetProcessesByName("taskmgr");
    if (processes.Count() > 0)
    {
        Console.WriteLine("Task Manager IS running");
    }
    else
    {
        Console.WriteLine("Task Manager is NOT running");
    }

    Hope this helps


    Please mark the best replies as answers - Twitter: @rickvdbosch - Blog: http://bloggingabout.net/blogs/rick

    Wednesday, November 7, 2012 10:40 AM
  • Hi Joon, on menu bar(toolbar) right clik and open taskmgr, it works fine no video lost detected and even the cpu usage remains the same 18-20%. but when you select the taskmgr by pressing keys Ctrl+Alt+Del, the problem arises.

    Actually, the prblm is not with task mgr, when we press keys Ctrl+Alt+Del we will see a windows screen where it says Lock USer, Switch User, Start TaskMrg etc...then when you choose taskmgr from this screen then video disappears and cpu usage goes directly to 99%.

    That screen makes the problem...we can't ignore Ctrl+Alt+Del, so atleast i want to restart graphs when this screen appears.




    • Edited by VinayGaddam Wednesday, November 7, 2012 11:49 AM updated
    Wednesday, November 7, 2012 11:36 AM
  • It's not strictly true to say you can't do this - there are numerous ways to do this successfully - each are although dependent upon which version of Windows is running, and what privileges one has for the running application.

    Digital Forensic Software Developer
    http://www.pledgebank.com/StopOnlineAbuse

    Online Safety Net
    Mark as Answer or Vote up if useful thank you!
    Volunteer Developers Required to work on free systems that can be used to reduce online child abuse and bullying! contact: dave@online-safety.net if you are interested.

    Friday, April 12, 2013 7:43 PM