Skip to content

Commit 66c23fa

Browse files
committed
Re-added "/startDisabled" flag.
1 parent 2372a7d commit 66c23fa

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

WinKill/WinKill.vcxproj.user

+5
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55
</LocalDebuggerCommandArguments>
66
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
77
</PropertyGroup>
8+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
9+
<LocalDebuggerCommandArguments>
10+
</LocalDebuggerCommandArguments>
11+
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
12+
</PropertyGroup>
813
</Project>

WinKill/main.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Shellapi.h>
44
#include <tchar.h>
55
#include <WinKillHook.h>
6+
#include <string>
67
#include "resource.h"
78

89
#define WM_MYTRAYICON WM_USER + 2000
@@ -28,11 +29,14 @@ static void startHook();
2829
static void stopHook();
2930
static void toggleHook();
3031
static void createWindow(HINSTANCE instance);
32+
static bool startDisabled(LPWSTR args);
3133
static LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
3234

3335
int CALLBACK wWinMain(HINSTANCE instance, HINSTANCE prev, LPWSTR args, int showType) {
3436
createWindow(instance);
3537

38+
startDisabled(args) ? stopHook() : startHook();
39+
3640
MSG msg = { };
3741
while (GetMessage(&msg, nullptr, 0, 0)) {
3842
TranslateMessage(&msg);
@@ -88,6 +92,15 @@ static LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
8892
return DefWindowProc(hwnd, msg, wParam, lParam);
8993
}
9094

95+
static bool startDisabled(LPWSTR args) {
96+
if (!args) {
97+
return false;
98+
}
99+
100+
std::wstring str(args);
101+
return str.find(L"/startDisabled") != std::string::npos;
102+
}
103+
91104
static void createWindow(HINSTANCE instance) {
92105
iconActive = LoadIcon(instance, MAKEINTRESOURCE(IDR_MAINFRAME));
93106
iconKilled = LoadIcon(instance, MAKEINTRESOURCE(IDI_KILLED));

0 commit comments

Comments
 (0)