Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Ctrl Alt F4

Ctrl Alt F4

Scheduled Pinned Locked Moved C / C++ / MFC
questioncomgame-devjsontutorial
8 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christopher Duncan
    wrote on last edited by
    #1

    This is so terribly embarrassing. An old dog like myself shouldn't be asking such stupid questions, but for the life of me I'm can't find the right switch to flip. Of course, I knew I was in trouble when I heard myself mutter, "All I wanted to do was..." :doh: IE7 has a convoluted Ctrl+Alt+F4 combination to close all but the current tab (best as I can determine from Google, etc., there is no Tabs API, bizarre as that may be). So, in a toolbar I wrote, I simply wanted to add a button so the user could click to close all tabs instead of playing a game of Twister with their fingers. WM_KEYDOWN, SendInput, Get/SetKeyboardState, I've screwed around with all of this, but I can't seem to find the proper approach to send this particular keystroke combination. Of course, it's the combination of Ctrl and Alt that is the complicating factor. So, how 'bout it - any of you old dogs (or all the young dogs who are much brighter than I am) know how to accomplish this? It really feels like one of those solutions that's going to be so simple as to make me feel quite inept once discovered, but hey, I've been there before. :) Thanks for any insights you might offer.

    Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

    S 1 Reply Last reply
    0
    • C Christopher Duncan

      This is so terribly embarrassing. An old dog like myself shouldn't be asking such stupid questions, but for the life of me I'm can't find the right switch to flip. Of course, I knew I was in trouble when I heard myself mutter, "All I wanted to do was..." :doh: IE7 has a convoluted Ctrl+Alt+F4 combination to close all but the current tab (best as I can determine from Google, etc., there is no Tabs API, bizarre as that may be). So, in a toolbar I wrote, I simply wanted to add a button so the user could click to close all tabs instead of playing a game of Twister with their fingers. WM_KEYDOWN, SendInput, Get/SetKeyboardState, I've screwed around with all of this, but I can't seem to find the proper approach to send this particular keystroke combination. Of course, it's the combination of Ctrl and Alt that is the complicating factor. So, how 'bout it - any of you old dogs (or all the young dogs who are much brighter than I am) know how to accomplish this? It really feels like one of those solutions that's going to be so simple as to make me feel quite inept once discovered, but hey, I've been there before. :) Thanks for any insights you might offer.

      Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

      S Offline
      S Offline
      Saurabh Garg
      wrote on last edited by
      #2

      I don't know how to send keys but there is an article KeyStrokeEngine[^]. I just tried the demo application and it can successfully send CTRL+ALT+F4 to IE. Maybe looking into source will tell you how to post a message yourself. -Saurabh

      modified on Tuesday, April 29, 2008 10:36 PM

      C 1 Reply Last reply
      0
      • S Saurabh Garg

        I don't know how to send keys but there is an article KeyStrokeEngine[^]. I just tried the demo application and it can successfully send CTRL+ALT+F4 to IE. Maybe looking into source will tell you how to post a message yourself. -Saurabh

        modified on Tuesday, April 29, 2008 10:36 PM

        C Offline
        C Offline
        Christopher Duncan
        wrote on last edited by
        #3

        Hi, Saurabh. I looked over his code, seems to be a nice piece of work. Reviewing it put me onto keybd_event(), which is an approach I hadn't been aware of (probably because it's been superceded by the somewhat more convoluted SendInput()). keybd_event() is pretty straightforward to use, and when I plugged in the key down and then key up calls for control, alt and F4, it worked like a charm. For those who may be interested, here's the snippet that got it done: // key down for ctrl, alt and F4 keybd_event(VK_CONTROL,0x9d,0 , 0); keybd_event(VK_MENU,0xb8,0 , 0); keybd_event(VK_F4,0,0 , 0); // key up for ctrl, alt and F4 keybd_event(VK_CONTROL,0x9d,KEYEVENTF_KEYUP,0); keybd_event(VK_MENU,0xb8,KEYEVENTF_KEYUP,0); keybd_event(VK_F4,0, KEYEVENTF_KEYUP,0); Thanks very much for taking the time to help me - I do appreciate it! :)

        Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

        S V 2 Replies Last reply
        0
        • C Christopher Duncan

          Hi, Saurabh. I looked over his code, seems to be a nice piece of work. Reviewing it put me onto keybd_event(), which is an approach I hadn't been aware of (probably because it's been superceded by the somewhat more convoluted SendInput()). keybd_event() is pretty straightforward to use, and when I plugged in the key down and then key up calls for control, alt and F4, it worked like a charm. For those who may be interested, here's the snippet that got it done: // key down for ctrl, alt and F4 keybd_event(VK_CONTROL,0x9d,0 , 0); keybd_event(VK_MENU,0xb8,0 , 0); keybd_event(VK_F4,0,0 , 0); // key up for ctrl, alt and F4 keybd_event(VK_CONTROL,0x9d,KEYEVENTF_KEYUP,0); keybd_event(VK_MENU,0xb8,KEYEVENTF_KEYUP,0); keybd_event(VK_F4,0, KEYEVENTF_KEYUP,0); Thanks very much for taking the time to help me - I do appreciate it! :)

          Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

          S Offline
          S Offline
          Saurabh Garg
          wrote on last edited by
          #4

          Hey Chris, You are most welcome and thanks for the code snippet. -Saurabh

          1 Reply Last reply
          0
          • C Christopher Duncan

            Hi, Saurabh. I looked over his code, seems to be a nice piece of work. Reviewing it put me onto keybd_event(), which is an approach I hadn't been aware of (probably because it's been superceded by the somewhat more convoluted SendInput()). keybd_event() is pretty straightforward to use, and when I plugged in the key down and then key up calls for control, alt and F4, it worked like a charm. For those who may be interested, here's the snippet that got it done: // key down for ctrl, alt and F4 keybd_event(VK_CONTROL,0x9d,0 , 0); keybd_event(VK_MENU,0xb8,0 , 0); keybd_event(VK_F4,0,0 , 0); // key up for ctrl, alt and F4 keybd_event(VK_CONTROL,0x9d,KEYEVENTF_KEYUP,0); keybd_event(VK_MENU,0xb8,KEYEVENTF_KEYUP,0); keybd_event(VK_F4,0, KEYEVENTF_KEYUP,0); Thanks very much for taking the time to help me - I do appreciate it! :)

            Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

            V Offline
            V Offline
            vijay_aroli
            wrote on last edited by
            #5

            Hello sir. It looks like your problem is solved. Good to know about that. I was really surprised to see you post a question here. Honestly, I never ever thought that I will see someone like you to post a question here. :) BTW, I have been a great admirer of your articles. :)

            Regards, Vijay.

            C 1 Reply Last reply
            0
            • V vijay_aroli

              Hello sir. It looks like your problem is solved. Good to know about that. I was really surprised to see you post a question here. Honestly, I never ever thought that I will see someone like you to post a question here. :) BTW, I have been a great admirer of your articles. :)

              Regards, Vijay.

              C Offline
              C Offline
              Christopher Duncan
              wrote on last edited by
              #6

              Hi, Vijay. Thanks for the kind words, man - glad you enjoy my ramblings. As for asking questions, hey, I'm just a geek like everyone else around here. Some days are good, some days are okay, and some days the screen turns a particularly interesting shade of the color blue. :-D

              Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

              V 1 Reply Last reply
              0
              • C Christopher Duncan

                Hi, Vijay. Thanks for the kind words, man - glad you enjoy my ramblings. As for asking questions, hey, I'm just a geek like everyone else around here. Some days are good, some days are okay, and some days the screen turns a particularly interesting shade of the color blue. :-D

                Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

                V Offline
                V Offline
                vijay_aroli
                wrote on last edited by
                #7

                When I entered the forum here today, I saw your post at the top and just asked myself -"Am I in the Lounge?". I had to check once to make sure that I was in the C++ forum and not in the Lounge. :)

                Christopher Duncan wrote:

                hey, I'm just a geek like everyone else around here. Some days are good, some days are okay, and some days the screen turns a particularly interesting shade of the color blue.

                Yes, but I believed that people with reputation as high as yours either don't face any problem while programming or they restrain themselves from asking for help here if they face any. But its really nice to see you post a question and ask for help here. ;)

                Regards, Vijay.

                N 1 Reply Last reply
                0
                • V vijay_aroli

                  When I entered the forum here today, I saw your post at the top and just asked myself -"Am I in the Lounge?". I had to check once to make sure that I was in the C++ forum and not in the Lounge. :)

                  Christopher Duncan wrote:

                  hey, I'm just a geek like everyone else around here. Some days are good, some days are okay, and some days the screen turns a particularly interesting shade of the color blue.

                  Yes, but I believed that people with reputation as high as yours either don't face any problem while programming or they restrain themselves from asking for help here if they face any. But its really nice to see you post a question and ask for help here. ;)

                  Regards, Vijay.

                  N Offline
                  N Offline
                  Nelek
                  wrote on last edited by
                  #8

                  The biggest wisemen are always those that know where their limits are and are not afraid to recognise that they have errors/questions as the rest of the "mortal" people, although less ;)

                  Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups