Ctrl c and close this windows

CTRL+C and CTRL+BREAK Signals

The CTRL + C and CTRL + BREAK key combinations receive special handling by console processes. By default, when a console window has the keyboard focus, CTRL + C or CTRL + BREAK is treated as a signal (SIGINT or SIGBREAK) and not as keyboard input. By default, these signals are passed to all console processes that are attached to the console. (Detached processes are not affected. See Creation of a Console.) The system creates a new thread in each client process to handle the event. The thread raises an exception if the process is being debugged. The debugger can handle the exception or continue with the exception unhandled.

CTRL + BREAK is always treated as a signal, but an application can change the default CTRL + C behavior in two ways that prevent the handler functions from being called:

  • The SetConsoleMode function can disable the ENABLE_PROCESSED_INPUT input mode for a console’s input buffer, so CTRL+C is reported as keyboard input rather than as a signal.
  • When SetConsoleCtrlHandler is called with NULL and TRUE values for its parameters, the calling process ignores CTRL+C signals. Normal CTRL+C processing is restored by calling SetConsoleCtrlHandler with NULL and FALSE values. This attribute of ignoring or not ignoring CTRL+C signals is inherited by child processes, but it can be enabled or disabled by any process without affecting existing processes.

For more information on how these signals are processed, including timeouts, please see the Handler Routine callback documentation.

Quickly Close Open Windows Using Shortcut Keys

How to type your way out of a mess with Windows keyboard shortcuts

One of the advantages of Microsoft Windows PCs is that you can have many different programs and windows open at the same time. This advantage becomes a disadvantage, however, when you have to close dozens of open windows. Fortunately, you can carry out repetitive actions like closing windows with keyboard shortcuts.

Instructions in this article apply to Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP.

How to Close Windows With Alt + Spacebar + C

One option for closing windows with keyboard shortcuts is as follows:

Open the window that you would like to close using your mouse.

Press and hold down the Alt key, then press the Spacebar to reveal the right-click context menu at the top of the program window you’re trying to close.

Release both keys and press the letter C. This will cause the window to close.

If you can execute this sequence using one hand while the other hand controls the mouse, you’ll be able to close roughly a dozen windows in about as many seconds.

Читайте также:  Настройка высокоскоростного подключения windows

How to Close Windows With Fn + Alt + F4

Another option is to select the window you want to close and then press Fn+Alt+F4. You’ll probably need two hands for this one.

Although the shortcut is officially listed as Alt+F4, you must hold down the Function (Fn) key for it to work.

How to Close Tabs With CTRL + W

The Ctrl+W shortcut only closes the current file you’re working on, but it leaves the program open. This feature can be handy if you want to leave the desktop program open but get rid of all the files you’re working on in quick succession.

Ctrl+W works in most browsers too, so you can close the current tab you’re looking at without taking your hands off the keyboard. If you use Ctrl+W when only one browser tab is open, then the program window will close.

How to Select Open Windows With Alt + Tab

It’s possible to select an open window without using the mouse. Press Alt+Tab to cycle through your open windows. Use this shortcut in conjunction with the other shortcuts to close all open windows without taking your hands off the keyboard.

How to See Your Desktop With Windows Key + D

Sometimes you don’t actually want to close all those windows; what you really want to do is just look at your desktop. To quickly access your desktop, press the Windows Key+D. Use the same shortcut to bring back all your windows.

If you are running Windows 7 or later, there are multiple ways to access your Windows desktop.

How to Close a Group of Windows With the Mouse

When you have numerous files open in the same program, like a bunch of emails in Outlook, Word files, or several spreadsheets in Excel, you can close all of them at once using the mouse. Right-click the program in the Windows taskbar and select Close all windows (or Close Group in older versions of Windows).

Prompt not appearing and Ctrl-C closes the window #5503

Comments

karansinghgit commented Jun 29, 2020 •

Environment

Steps to reproduce

Expected behavior

  1. Prompt appears
  2. Control C doesn’t close the window

Actual behavior

  1. The Prompt doesn’t appear. I’ve had an issue for a while, where the prompt takes 5-10 seconds to load. I usually hit Ctrl-C and the prompt loads up instantly after that. But today, the prompt doesn’t appear at all. I still get the blinking underscore without the prompt.
    Typing doesn’t do anything. Also, Ctrl-C instantly closes the window.
  2. Additionally, can’t use any of the wsl commands on cmd and powershell. The only command which works is wsl —help.
    The others seem to load forever.

The text was updated successfully, but these errors were encountered:

karansinghgit commented Jun 29, 2020

Found a temporary fix by doing a Full Reboot as stated here:

But it might happen again and the prompt still took a few seconds to load. On pressing Ctrl-C, it terminates the loading and I can see the prompt again. Is there a fix to this?

sirredbeard commented Jul 2, 2020

Next this happens, I would try restarting LxssManager from Services.

Luan-Farias commented Jul 3, 2020

Yesterday this problem happen to my ubuntu distro too, I see in task manager and I noticed that the Vmmem (This is a process that makes suport the virtual machines) is not processing, so I think that this is part of the problem too.

Читайте также:  Png ������ ��� mac os

Luan-Farias commented Jul 3, 2020 •

Hello. I fix it with a tutorial in stack overflow. I don’t have the link anymore but the steps are

Press win + r and paste REDEGIT

Will open the Registry Editor so go to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > LxssManager click on Start and set the Value data and change to 2 , then you restart your computer and open ubuntu again. It’s work for me so I hope that works for you.

rahilwazir commented Sep 21, 2020 •

Will open the Registry Editor so go to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > LxssManager click on Start and set the Value data and change to 2, then you restart your computer and open ubuntu again. It’s work for me so I hope that works for you.

This fixed didn’t work for me. Still stuck at blank screen.

Next this happens, I would try restarting LxssManager from Services.

@sirredbeard When restarting the service, it hung up on Stopping status

Event Viewer has following to say

Faulting application name: wsl.exe, version: 10.0.20215.1000, time stamp: 0xe55a6b54
Faulting module name: ucrtbase.dll, version: 10.0.20215.1000, time stamp: 0x9889057c
Exception code: 0xc0000409
Fault offset: 0x000000000007cb9e
Faulting process id: 0x42e0
Faulting application start time: 0x01d6902a7aa5c947
Faulting application path: C:\WINDOWS\system32\wsl.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report Id: 3ff0772e-9fe8-42d6-805d-8d61f73c7968
Faulting package full name:
Faulting package-relative application ID:

Edit: After waiting for long enough, the prompt gives the following error

There are no more endpoints available from the endpoint mapper.

[process exited with code 4294967295]

Handle CTRL+C on Win32

I have some problems with the handling of CTRL + C events, in a Win32 C++ console program.

Basically my program looks like this: (based on this other question: Windows Ctrl-C — Cleaning up local stack objects in command line app)

The problem is the cleanup code not being executed at all.

After the execution of the handler function the process is terminated, but without execute the code after the main loop. What’s wrong?

EDIT: as requested, this is a minimal test case similar to my program: http://pastebin.com/6rLK6BU2

I don’t get the «test cleanup-instruction» string in my output.

I don’t know if this is important, I’m compiling with MinGW.

EDIT 2: The problem with the test case program is the use of the Sleep() function. Without it the program works as expected.

In Win32 the function handler runs in another thread, so when the handler/thread ends its execution the main thread is sleeping. Probably this is the cause of process interruption?

4 Answers 4

The following code works for me:

Depending on your specific requirements you have a number of options. If you simply want to ignore Ctrl + C you can call SetConsoleCtrlHandler passing NULL as the HandlerRoutine parameter:

This removes all signal handlers. To terminate this application you have to implement custom logic to determine when to shut down.

If you want to handle Ctrl + C you have two options: Set up a handler for the signal or pass the keyboard input on to regular keyboard handling.

Setting up a handler is similar to the code above, but instead of passing NULL as the handler you provide your own implementation.

The output of this application is:

Note that cleanup code is executed, regardless of the code inside the main while -loop. Signal handlers form a linked list, where the handler functions are called on a last-registered, first-called basis until one of the handlers returns TRUE . If none of the handlers returns TRUE, the default handler is called. The default handler for a console calls ExitProcess when processing Ctrl + C .

Читайте также:  Dubstep cube для windows

If you want to prevent any preprocessing and handle Ctrl + C as regular keyboard input instead you have to change the console mode by calling SetConsoleMode .

Once the ENABLE_PROCESSED_INPUT flag is removed Ctrl + C is no longer processed by the system and passed to the console like regular keyboard input. It can be read using ReadConsoleInput or ReadFile .

Disclaimer: The above has been tested on Windows 8 64bit, compiled for 32 and 64 bit, Release and Debug configurations.

Не могу запустить Gta 4.Пишет Ctrl+C and close this window when you»re done playing.

Код ошибки — Расшифровка.

RMN20 — Windows Vista: требуется Service Pack 1.

RMN30 — Windows XP 64 / Server 2003: требуется Service Pack 2.

RMN40 — Windows XP: требуется Service Pack 3.

DD3D50 D3D Error — видео карта не поддерживает DirectX 9.

TEXP110 D3D Error — Невозможно создать текстуру — Пожалуйста перезапустите игру.

DWIN20 D3D Error — Ошибка при обращении к памяти. Пожалуйста перезапустите игру.

DD3D10 D3D Error — Перезапустите компьютер.

DD3D10 D3D Error — Перезапустите компьютер.

DD3D30 D3D Error — Перезапустите компьютер.

DWIN30 D3D Error — Перезапустите компьютер.

DD3D20 D3D Error — Переустановите игру и/или переустановите DirectX.

DWIN10 D3D Error — Пожалуйста перезапустите игру.

DD3D60 D3D Error — Отсутствует поддержка Shader Model 3.0.

DD3D70 D3D Error — Ошибка D3D устройства. Перезапустите компьютер.

GPUP10 D3D Error — Ошибка D3D устройства. Перезапустите компьютер.

TEXP20 D3D Error — Ошибка D3D устройства. Перезапустите компьютер.

TEXP30 D3D Error — Ошибка D3D устройства. Перезапустите компьютер.

TEXP80 D3D Error — Ошибка D3D устройства. Перезапустите компьютер.

DD3D40 D3D Error — Ошибка видео карты. Установите последнюю версию драйверов и/или переустановите DirectX.

TEXP10 D3D Error — Ошибка видео карты. Установите последнюю версию драйверов и/или переустановите DirectX.

DD3D80 D3D reset failed — Перезапустите игру.

STRB10 Failed to delete file — Ошибка при удалении файла. Перезапустите компьютер.

RMN10 Failed to read file — Ошибка при чтении файла. Перезапустите компьютер.

STRM10 Failed to read file — Ошибка при чтении файла. Перезапустите компьютер.

STRM20 Failed to read file — Ошибка при чтении файла. Перезапустите компьютер.

BNDL10 Failed to write file – Ошибка при записи файла. Перезапустите компьютер.

STBF10 Failed to write file – Ошибка при записи файла. Перезапустите компьютер.

VOIC10 Fatal voice chat error — Ошибка голосового чата. Перезапустите игру.

RESC10 Out of video memory — Заполнена видео память. Перезапустите компьютер.

BA10 Out of virtual memory — Заполнена виртуальная память. Перезапустите компьютер.

EA10 Out of virtual memory — Заполнена виртуальная память. Перезапустите компьютер.

TEXP60 Unable to create color render target — Ошибка рендеринга цвета. Установите последнюю версию драйверов и/или переустановите DirectX.

TEXP70 Unable to create depth render target — Ошибка рендеринга глубины. Установите последнюю версию драйверов и/или переустановите DirectX.

AE10 Insufficient Memory to Start Game — Недостаточно памяти для запуска игры. Закройте все лишние приложения.

PC10 Unable to retrieve D3D Device — Перезапустите компьютер или переустановите драйвера на видеокарту.

TF10 Unable to write to disk — Ошибка чтения диска. Перезапустите игру.

WS20 InitWinSock failed — Перезапустите компьютер и/или переустановите игру.

WS30 InitWinSock failed — Перезапустите компьютер и/или переустановите игру.

Оцените статью