diff --git a/README.md b/README.md
index 15c2589..b2cf096 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Well, I'm a node.js developer. Node has a functionality that could send signals
## Features
- Support both **32bit** (Win32) & **64bit** (x64) Windows
-- Support both ```SIGBREAK``` (Ctrl + Break) and ```SIGINT``` (Ctrl + C) Signals
+- Support `SIGBREAK` (Ctrl + Break), `SIGINT` (Ctrl + C), and `SIGCLOSE` (click close button) Signals.
- A library that could be used directly (#include), As a static library (.lib) and a dynamic library (.dll)
- Prebuilt binaries and libraries
@@ -65,6 +65,14 @@ If signal sending was successful or any error occurred during the sending, appro
> windows-kill -2 1234
```
+#### Sending SIGCLOSE (click close button) to sample 1234 PID
+```bash
+> windows-kill -SIGCLOSE 1234
+```
+```bash
+> windows-kill -3 1234
+```
+
#### List supported signal types
```bash
> windows-kill -l
diff --git a/windows-kill-library/signal.cpp b/windows-kill-library/signal.cpp
index 1324eb7..791f666 100644
--- a/windows-kill-library/signal.cpp
+++ b/windows-kill-library/signal.cpp
@@ -24,7 +24,7 @@ namespace WindowsKillLibrary {
}
void Signal::validateType(DWORD_PTR type) {
- if (!(type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT)) {
+ if (!(type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT || type == CTRL_CLOSE_EVENT)) {
throw invalid_argument(string("EINVAL"));
}
}
diff --git a/windows-kill-library/windows-kill-library.h b/windows-kill-library/windows-kill-library.h
index adb4c15..e11ff07 100644
--- a/windows-kill-library/windows-kill-library.h
+++ b/windows-kill-library/windows-kill-library.h
@@ -25,6 +25,13 @@ namespace WindowsKillLibrary {
///
const DWORD SIGNAL_TYPE_CTRL_BREAK = CTRL_BREAK_EVENT;
+
+ ///
+ /// Signal type of Close console window same as Signal SIGTERM
+ ///
+ const DWORD SIGNAL_TYPE_CLOSE_EVENT = CTRL_CLOSE_EVENT;
+
+
///
/// Sends the signal.
///
diff --git a/windows-kill/windows-kill.cpp b/windows-kill/windows-kill.cpp
index 4f9a2bc..a8761e1 100644
--- a/windows-kill/windows-kill.cpp
+++ b/windows-kill/windows-kill.cpp
@@ -13,6 +13,7 @@ using std::exception;
using WindowsKillLibrary::sendSignal;
using WindowsKillLibrary::SIGNAL_TYPE_CTRL_C;
using WindowsKillLibrary::SIGNAL_TYPE_CTRL_BREAK;
+using WindowsKillLibrary::SIGNAL_TYPE_CLOSE_EVENT;
#define WINDOWSKILL_VERSION "1.1.4"
@@ -37,7 +38,8 @@ int main(int argc,char *argv[])
else if (strcmp(argv[1], "-l") == 0) {
cout << "Availabe Signal Types\n"
<< "\t(1) (SIGBREAK) : CTR + Break\n"
- << "\t(2) (SIGINT) : CTR + C\n" << endl;
+ << "\t(2) (SIGINT) : CTR + C\n"
+ << "\t(3) (SIGCLOSE) : click close button\n" << endl;
}
else {
cout << "Not enough argument. Use -h for help." << endl;
@@ -51,6 +53,9 @@ int main(int argc,char *argv[])
else if (strcmp(argv[1], "-2") == 0 || strcmp(argv[1], "-SIGINT") == 0) {
signal_type = SIGNAL_TYPE_CTRL_C;
}
+ else if (strcmp(argv[1], "-3") == 0 || strcmp(argv[1], "-SIGCLOSE") == 0) {
+ signal_type = SIGNAL_TYPE_CLOSE_EVENT;
+ }
else {
cout << "Signal type " << argv[1] << " not supported. Use -h for help." << endl;
return 0;