Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba18587c31 | |||
| c6d9f908e5 | |||
| 8fbd6f1bde | |||
| 7c73a52f0a | |||
| 05c4ad977b | |||
| c968b47baf | |||
| 6f6ce164ee | |||
| 7cd58a9a15 | |||
| d5b3ef1040 | |||
| 76099356cd | |||
| 750ac44696 | |||
| 0a0fe05555 | |||
| b6a0f9a3c5 | |||
| e7c06ec4b6 | |||
| f58e6a99cb | |||
| b5e040f3d5 | |||
| fee7025323 | |||
|
|
6c9855ab38 | ||
|
|
3f438f6038 | ||
| 7491ed2ca7 | |||
| 166cdd0d88 | |||
| d1ab2b86e2 | |||
| 690f621f5b | |||
| 01eb9075b4 | |||
| 5137eed759 | |||
| b8d3db9289 | |||
| a4af63ed34 | |||
|
|
f394d436cf | ||
|
|
bdb2ebd295 | ||
|
|
bd5d845ec1 | ||
|
|
a6c866d1dd | ||
|
|
38a570310f | ||
|
|
4a96fef1c7 | ||
|
|
0f47ebae9e | ||
| f8b925d0f8 | |||
| 35f791d7a0 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -326,7 +326,7 @@ var/
|
|||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
*.manifest
|
#*.manifest
|
||||||
*.spec
|
*.spec
|
||||||
|
|
||||||
# Installer logs
|
# Installer logs
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -1,6 +1,12 @@
|
|||||||
# wCenterWindow
|
# wCenterWindow
|
||||||
This program centers the current active window by a `LCTRL + LWIN + C` hotkey.
|
This program centers the current active window by a ```LCTRL + LWIN + C``` hotkey,
|
||||||
|
or pressing ```LCTRL + LWIN + MMB``` (Middle Mouse Button).
|
||||||
|
|
||||||
`LCTRL + LWIN + I` hotkey - hide tray icon.
|
```LCTRL + LWIN + V``` - manual editing of size and position of the window.
|
||||||
|
|
||||||
You can add `/hide` option to command line for hiding trayicon at startup.
|
You can use ```LCTRL + LWIN + I``` hotkey for hide/show trayicon.
|
||||||
|
You can also use commandline option ```/hide``` for hide trayicon at startup.
|
||||||
|
|
||||||
|
```Use workarea``` option means that the window is centered without a taskbar, otherwise, the full resolution of the monitor will be used.
|
||||||
|
|
||||||
|
If some windows does not centers you should run wCenterWindow with administrative rights.
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 15.0.28307.1000
|
VisualStudioVersion = 16.0.31112.23
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wCenterWindow", "wCenterWindow\wCenterWindow.vcxproj", "{6A775901-6C34-4E96-B359-C11C76A520BB}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wCenterWindow", "wCenterWindow\wCenterWindow.vcxproj", "{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Debug|x64.ActiveCfg = Debug|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Debug|x64.Build.0 = Debug|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x64.Build.0 = Debug|x64
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Debug|x86.ActiveCfg = Debug|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Debug|x86.Build.0 = Debug|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Release|x64.ActiveCfg = Release|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x64.ActiveCfg = Release|x64
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Release|x64.Build.0 = Release|x64
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x64.Build.0 = Release|x64
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Release|x86.ActiveCfg = Release|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{6A775901-6C34-4E96-B359-C11C76A520BB}.Release|x86.Build.0 = Release|Win32
|
{F1A1603A-F5D0-47B8-8E4B-CF17747BCFBA}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {CAD0B026-63B6-4645-9B26-22CD0E1049B7}
|
SolutionGuid = {83F3F9B6-B00E-4705-9C92-19308AAC038B}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
76
wCenterWindow/Logger.cpp
Normal file
76
wCenterWindow/Logger.cpp
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
// wCenterWindow, v2.3.3
|
||||||
|
// Logger.cpp
|
||||||
|
//
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
#define TS_LEN 30
|
||||||
|
#define PATH_LEN 1024
|
||||||
|
|
||||||
|
std::wofstream logfile;
|
||||||
|
extern WCHAR szTitle[];
|
||||||
|
extern LPVOID szBuffer;
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
std::wstring PrintTitle()
|
||||||
|
{
|
||||||
|
wchar_t szWinTitle[2048];
|
||||||
|
StringCchPrintf(szWinTitle, 2048, L"%s", szBuffer);
|
||||||
|
return szWinTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring GetTimeStamp()
|
||||||
|
{
|
||||||
|
SYSTEMTIME lt;
|
||||||
|
GetLocalTime(<);
|
||||||
|
wchar_t ts[TS_LEN];
|
||||||
|
StringCchPrintfW(ts, TS_LEN, L"%d-%02d-%02d %02d:%02d:%02d.%03d - ", lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds);
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenLogFile()
|
||||||
|
{
|
||||||
|
wchar_t lpszPath[PATH_LEN]{};
|
||||||
|
DWORD dwPathLength = GetModuleFileNameW(NULL, lpszPath, PATH_LEN);
|
||||||
|
DWORD dwError = GetLastError();
|
||||||
|
if (ERROR_INSUFFICIENT_BUFFER == dwError)
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL, L"Path to logfile is too long! Working without logging.", (LPCWSTR)szTitle, MB_OK | MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (NULL == dwPathLength)
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL, L"Can't get module filename! Working without logging.", (LPCWSTR)szTitle, MB_OK | MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs::path log_path = lpszPath;
|
||||||
|
log_path.replace_extension(L".log");
|
||||||
|
fs::path bak_path = log_path;
|
||||||
|
bak_path.replace_extension(L".bak");
|
||||||
|
|
||||||
|
if (fs::exists(log_path)) fs::rename(log_path, bak_path);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
log_path = L"d:\\test.log";
|
||||||
|
#endif
|
||||||
|
logfile.open(log_path);
|
||||||
|
if (logfile.is_open())
|
||||||
|
{
|
||||||
|
diag_log(L"Start logging.");
|
||||||
|
diag_log(L"Logfile:", log_path);
|
||||||
|
diag_log(log_path, L"successfully opened.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBoxW(NULL, L"Can't open logfile! Working without logging.", (LPCWSTR)szTitle, MB_OK | MB_ICONWARNING);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CloseLogFile()
|
||||||
|
{
|
||||||
|
if (logfile)
|
||||||
|
{
|
||||||
|
diag_log(L"End logging.");
|
||||||
|
logfile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
60
wCenterWindow/Logger.h
Normal file
60
wCenterWindow/Logger.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// wCenterWindow, v2.3.3
|
||||||
|
// Logger.h
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
extern std::wofstream logfile;
|
||||||
|
std::wstring GetTimeStamp();
|
||||||
|
std::wstring PrintTitle();
|
||||||
|
|
||||||
|
template <typename T1>
|
||||||
|
void diag_log(T1 arg1)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
void diag_log(T1 arg1, T2 arg2)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << ' ' << arg2 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T1, typename T2, typename T3>
|
||||||
|
void diag_log(T1 arg1, T2 arg2, T3 arg3)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << ' ' << arg2 << ' ' << arg3 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T1, typename T2, typename T3, typename T4>
|
||||||
|
void diag_log(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << ' ' << arg2 << ' ' << arg3 << ' ' << arg4 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||||
|
void diag_log(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << ' ' << arg2 << ' ' << arg3 << ' ' << arg4 << ' ' << arg5 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||||
|
void diag_log(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << ' ' << arg2 << ' ' << arg3 << ' ' << arg4 << ' ' << arg5 << ' ' << arg6 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||||
|
void diag_log(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << ' ' << arg2 << ' ' << arg3 << ' ' << arg4 << ' ' << arg5 << ' ' << arg6 << ' ' << arg7 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||||
|
void diag_log(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
|
||||||
|
{
|
||||||
|
logfile << GetTimeStamp() << arg1 << ' ' << arg2 << ' ' << arg3 << ' ' << arg4 << ' ' << arg5 << ' ' << arg6 << ' ' << arg7 << ' ' << arg8 << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenLogFile();
|
||||||
|
void CloseLogFile();
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
// resource.h
|
|
||||||
#define IDS_APP_TITLE 100
|
|
||||||
#define IDS_CLASSNAME 101
|
|
||||||
#define IDS_HELPTEXT 102
|
|
||||||
#define IDI_TRAYICON 103
|
|
||||||
#define IDR_MENU 104
|
|
||||||
#define ID_POPUPMENU_HELP 105
|
|
||||||
#define ID_POPUPMENU_EXIT 106
|
|
||||||
#define IDS_ERR_MAIN 107
|
|
||||||
#define IDS_ERR_WND 108
|
|
||||||
#define IDS_ERR_ICON 109
|
|
||||||
#define IDS_ERR_MENU 110
|
|
||||||
#define IDS_ERR_POPUP 111
|
|
||||||
#define IDS_ERR_HOOK 112
|
|
||||||
#define IDS_RUNNING 113
|
|
||||||
#define IDC_STATIC -1
|
|
||||||
|
|
||||||
// Next default values for new objects
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
|
||||||
#define _APS_NO_MFC 1
|
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
|
||||||
#define _APS_NEXT_SYMED_VALUE 110
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
BIN
wCenterWindow/VersionInfo.rc
Normal file
BIN
wCenterWindow/VersionInfo.rc
Normal file
Binary file not shown.
@@ -1,15 +1,26 @@
|
|||||||
// header.h: включаемый файл для стандартных системных включаемых файлов
|
// header.h : include file for standard system include files,
|
||||||
// или включаемые файлы для конкретного проекта
|
// or project specific include files
|
||||||
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "targetver.h"
|
#include "targetver.h"
|
||||||
#define WIN32_LEAN_AND_MEAN // Исключите редко используемые компоненты из заголовков Windows
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
// Файлы заголовков Windows
|
|
||||||
#include <windows.h>
|
// Windows Header Files
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <string>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
// Файлы заголовков среды выполнения C
|
#include <CommCtrl.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
// C RunTime Header Files
|
||||||
#include <memory.h>
|
//#include <stdlib.h>
|
||||||
#include <tchar.h>
|
//#include <malloc.h>
|
||||||
|
//#include <memory.h>
|
||||||
|
|
||||||
|
// Project Specific Header Files
|
||||||
|
#include "Logger.h"
|
||||||
|
|||||||
47
wCenterWindow/resource.h
Normal file
47
wCenterWindow/resource.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by wCenterWindow.rc
|
||||||
|
//
|
||||||
|
#define IDS_CLASSNAME 102
|
||||||
|
#define IDS_APP_TITLE 103
|
||||||
|
#define IDD_ABOUTBOX 104
|
||||||
|
#define IDI_TRAYICON 105
|
||||||
|
#define IDR_MENU 106
|
||||||
|
#define ID_POPUPMENU_ICON 107
|
||||||
|
#define ID_POPUPMENU_AREA 108
|
||||||
|
#define ID_POPUPMENU_ABOUT 110
|
||||||
|
#define ID_POPUPMENU_EXIT 111
|
||||||
|
#define IDS_ABOUT 112
|
||||||
|
#define IDS_ERR_MAIN 113
|
||||||
|
#define IDS_ERR_WND 114
|
||||||
|
#define IDS_ERR_ICON 115
|
||||||
|
#define IDS_ERR_MENU 116
|
||||||
|
#define IDS_ERR_POPUP 117
|
||||||
|
#define IDS_ERR_HOOK 118
|
||||||
|
#define IDS_ERR_MAXMIN 119
|
||||||
|
#define IDS_RUNNING 121
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDD_MANUAL_EDITING 129
|
||||||
|
#define IDC_EDIT_X 1000
|
||||||
|
#define IDC_EDIT_Y 1001
|
||||||
|
#define IDC_EDIT_WIDTH 1002
|
||||||
|
#define IDC_EDIT_HEIGHT 1003
|
||||||
|
#define IDC_EDIT_TITLE 1004
|
||||||
|
#define IDC_EDIT_CLASS 1005
|
||||||
|
#define IDC_BUTTON_SET 1006
|
||||||
|
#define IDC_BUTTON_CLOSE 1007
|
||||||
|
#define IDC_ABOUTHELP 1008
|
||||||
|
#define IDC_DONATIONLINK 1009
|
||||||
|
#define IDC_STATIC -1
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NO_MFC 1
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1010
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 122
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -1,2 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// // Including SDKDDKVer.h defines the highest available Windows platform.
|
||||||
|
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||||
|
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||||
#include <SDKDDKVer.h>
|
#include <SDKDDKVer.h>
|
||||||
|
|||||||
@@ -1,255 +1,520 @@
|
|||||||
// wCenterWindow.cpp : Определяет точку входа для приложения.
|
// wCenterWindow, v2.3.3
|
||||||
|
//
|
||||||
#include "framework.h"
|
// TODO: More verbose logs - partially done.
|
||||||
#include "wCenterWindow.h"
|
// TODO: More verbose error messages
|
||||||
|
// TODO: Window's title in logs (Impossible?)
|
||||||
#define MAX_LOADSTRING 80
|
|
||||||
#define WM_WCW WM_USER + 0x7F00
|
#include "framework.h"
|
||||||
|
#include "wCenterWindow.h"
|
||||||
// Глобальные переменные:
|
|
||||||
HINSTANCE hInst; // Текущий экземпляр
|
#define KEY_I 0x49
|
||||||
WCHAR szTitle[MAX_LOADSTRING]; // Текст строки заголовка
|
#define KEY_C 0x43
|
||||||
WCHAR szClass[MAX_LOADSTRING]; // Имя класса главного окна
|
#define KEY_V 0x56
|
||||||
WCHAR szHelp[MAX_LOADSTRING]; // Текст описания
|
|
||||||
HHOOK KeyboardHook;
|
#define BUF_LEN 4096
|
||||||
HICON hIcon;
|
#define MAX_LOADSTRING 50
|
||||||
HMENU hMenu, hPopup;
|
#define WM_WCW 0x8F00
|
||||||
HWND hWnd;
|
|
||||||
NOTIFYICONDATA nid = { 0 };
|
// Global variables:
|
||||||
KBDLLHOOKSTRUCT *pkhs;
|
HINSTANCE hInst; // Instance
|
||||||
BOOL pressed = FALSE, showIcon = TRUE;
|
WCHAR szTitle[MAX_LOADSTRING]; // Window's title
|
||||||
BOOL bLCTRL = FALSE, bLWIN = FALSE, bKEYI = FALSE, bKEYC = FALSE;
|
WCHAR szClass[MAX_LOADSTRING]; // Window's class
|
||||||
int dtCenterX, dtCenterY;
|
WCHAR szAbout[MAX_LOADSTRING * 12]; // Description text
|
||||||
|
WCHAR szWinTitle[256];
|
||||||
// Прототипы функций
|
WCHAR szWinClass[256];
|
||||||
ATOM MyRegisterClass(HINSTANCE);
|
WCHAR szWinCore[] = TEXT("Windows.UI.Core.CoreWindow");
|
||||||
VOID ShowError(HINSTANCE, UINT);
|
HANDLE hHeap = NULL;
|
||||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
HHOOK hMouseHook = NULL, hKbdHook = NULL; // Hook's handles
|
||||||
LRESULT CALLBACK KeyboardHookProc(int, WPARAM, LPARAM);
|
HICON hIcon = NULL;
|
||||||
BOOL CreateTrayIcon();
|
HMENU hMenu = NULL, hPopup = NULL;
|
||||||
|
HWND hWnd = NULL, hFgWnd = NULL, hTaskBar = NULL, hDesktop = NULL, hProgman = NULL;
|
||||||
VOID parseCmdLine()
|
BOOL bKPressed = FALSE, bMPressed = FALSE, bShowIcon = TRUE, bWorkArea = TRUE;
|
||||||
{
|
BOOL bLCTRL = FALSE, bLWIN = FALSE, bKEYV = FALSE;
|
||||||
int nArgs = 0;
|
|
||||||
LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
RECT rcFW = { 0 };
|
||||||
(nArgs >= 2 && 0 == lstrcmpiW(szArglist[1], L"/hide")) ? showIcon = FALSE : showIcon = TRUE;
|
NOTIFYICONDATAW nid = { 0 };
|
||||||
LocalFree(szArglist);
|
LPKBDLLHOOKSTRUCT pkhs = { 0 };
|
||||||
}
|
MENUITEMINFO mii = { 0 };
|
||||||
|
|
||||||
// Точка входа
|
LPVOID szBuffer;
|
||||||
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
|
||||||
_In_opt_ HINSTANCE hPrevInstance,
|
// {2D7B7F30-4B5F-4380-9807-57D7A2E37F6C}
|
||||||
_In_ LPWSTR lpCmdLine,
|
static const GUID guid = { 0x2d7b7f30, 0x4b5f, 0x4380, { 0x98, 0x7, 0x57, 0xd7, 0xa2, 0xe3, 0x7f, 0x6c } };
|
||||||
_In_ int nCmdShow)
|
|
||||||
{
|
// Forward declarations of functions included in this code module:
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
VOID HandlingTrayIcon();
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
VOID ShowError(UINT);
|
||||||
|
BOOL CheckWindow(HWND);
|
||||||
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
BOOL CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
LoadStringW(hInstance, IDS_CLASSNAME, szClass, MAX_LOADSTRING);
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
if (FindWindow(szClass, NULL))
|
LRESULT CALLBACK KeyboardHookProc(int, WPARAM, LPARAM);
|
||||||
{
|
LRESULT CALLBACK MouseHookProc(int, WPARAM, LPARAM);
|
||||||
ShowError(hInstance, IDS_RUNNING);
|
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
MyRegisterClass(hInstance);
|
|
||||||
|
VOID MoveWindowToMonitorCenter(HWND hwnd, BOOL bWorkArea, BOOL bResize)
|
||||||
hWnd = CreateWindowExW(0, szClass, szTitle, 0, 0, 0, 0, 0, NULL, NULL, hInstance, NULL);
|
{
|
||||||
if (!hWnd)
|
//diag_log(L"Entering MoveWindowToMonitorCenter(): hwnd =", hwnd, L"Title:", (LPWSTR)szBuffer);
|
||||||
{
|
diag_log(L"Entering MoveWindowToMonitorCenter(): hwnd =", hwnd);
|
||||||
ShowError(hInstance, IDS_ERR_WND);
|
|
||||||
return FALSE;
|
RECT fgwrc = { 0 };
|
||||||
}
|
GetWindowRect(hwnd, &fgwrc);
|
||||||
|
LONG nWidth = fgwrc.right - fgwrc.left;
|
||||||
parseCmdLine();
|
LONG nHeight = fgwrc.bottom - fgwrc.top;
|
||||||
if (showIcon)
|
|
||||||
{
|
diag_log(L"Moving window from x =", fgwrc.left, L"y =", fgwrc.top);
|
||||||
if (!CreateTrayIcon())
|
|
||||||
{
|
MONITORINFO mi = { 0 };
|
||||||
ShowError(hInstance, IDS_ERR_ICON);
|
mi.cbSize = sizeof(MONITORINFO);
|
||||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
GetMonitorInfoW(MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST), &mi);
|
||||||
}
|
RECT area = { 0 };
|
||||||
}
|
if (bWorkArea)
|
||||||
|
{
|
||||||
hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU));
|
area.bottom = mi.rcWork.bottom;
|
||||||
if (!hMenu)
|
area.left = mi.rcWork.left;
|
||||||
{
|
area.right = mi.rcWork.right;
|
||||||
ShowError(hInstance, IDS_ERR_MENU);
|
area.top = mi.rcWork.top;
|
||||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
hPopup = GetSubMenu(hMenu, 0);
|
area.bottom = mi.rcMonitor.bottom;
|
||||||
if (!hPopup)
|
area.left = mi.rcMonitor.left;
|
||||||
{
|
area.right = mi.rcMonitor.right;
|
||||||
ShowError(hInstance, IDS_ERR_POPUP);
|
area.top = mi.rcMonitor.top;
|
||||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
}
|
||||||
}
|
|
||||||
|
int aw = area.right - area.left;
|
||||||
KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, hInstance, NULL);
|
int ah = area.bottom - area.top;
|
||||||
if (!KeyboardHook)
|
if (nWidth > aw && bResize) nWidth = aw;
|
||||||
{
|
if (nHeight > ah && bResize) nHeight = ah;
|
||||||
ShowError(hInstance, IDS_ERR_HOOK);
|
if (area.left < 0) aw = -aw;
|
||||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
if (area.top < 0) ah = -ah;
|
||||||
}
|
int x = (aw - nWidth) / 2;
|
||||||
|
int y = (ah - nHeight) / 2;
|
||||||
LoadStringW(hInstance, IDS_HELPTEXT, szHelp, MAX_LOADSTRING);
|
|
||||||
RECT dtrc = { 0 };
|
SendMessageW(hwnd, WM_ENTERSIZEMOVE, NULL, NULL);
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, NULL, &dtrc, FALSE);
|
MoveWindow(hwnd, x, y, nWidth, nHeight, TRUE);
|
||||||
dtCenterX = dtrc.right / 2, dtCenterY = dtrc.bottom / 2;
|
SendMessageW(hwnd, WM_EXITSIZEMOVE, NULL, NULL);
|
||||||
|
|
||||||
MSG msg;
|
diag_log(L"Moving window to x =", x, L"y =", y);
|
||||||
BOOL bRet;
|
diag_log(L"Quiting MoveWindowToMonitorCenter()");
|
||||||
|
}
|
||||||
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
|
|
||||||
{
|
|
||||||
if (bRet == -1)
|
ATOM MyRegisterClass(HINSTANCE hInstance)
|
||||||
{
|
{
|
||||||
ShowError(hInstance, IDS_ERR_MAIN);
|
WNDCLASSEX wcex = { 0 };
|
||||||
return -1;
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
}
|
wcex.lpfnWndProc = WndProc;
|
||||||
else
|
wcex.hInstance = hInstance;
|
||||||
{
|
wcex.hIcon = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_TRAYICON));
|
||||||
TranslateMessage(&msg);
|
wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW);
|
||||||
DispatchMessage(&msg);
|
wcex.lpszClassName = szClass;
|
||||||
}
|
wcex.hIconSm = wcex.hIcon;
|
||||||
}
|
hIcon = wcex.hIcon;
|
||||||
return (int)msg.wParam;
|
return RegisterClassExW(&wcex);
|
||||||
}
|
}
|
||||||
|
|
||||||
ATOM MyRegisterClass(HINSTANCE hInstance)
|
|
||||||
{
|
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
|
||||||
WNDCLASSEX wcex = { 0 };
|
{
|
||||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
wcex.lpfnWndProc = WndProc;
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
wcex.hInstance = hInstance;
|
|
||||||
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_TRAYICON));
|
OpenLogFile();
|
||||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
diag_log(L"Entering WinMain()");
|
||||||
wcex.lpszClassName = szClass;
|
|
||||||
wcex.hIconSm = wcex.hIcon;
|
hInst = hInstance;
|
||||||
hIcon = wcex.hIcon;
|
|
||||||
return RegisterClassEx(&wcex);
|
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, _countof(szTitle));
|
||||||
}
|
LoadStringW(hInstance, IDS_CLASSNAME, szClass, _countof(szClass));
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
if (FindWindowW(szClass, NULL))
|
||||||
{
|
{
|
||||||
switch (message)
|
ShowError(IDS_RUNNING);
|
||||||
{
|
return FALSE;
|
||||||
case WM_WCW:
|
}
|
||||||
if (lParam == WM_RBUTTONDOWN && wParam == IDI_TRAYICON)
|
|
||||||
{
|
MyRegisterClass(hInstance);
|
||||||
SetForegroundWindow(hWnd);
|
hWnd = CreateWindowExW(0, szClass, szTitle, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hInstance, NULL);
|
||||||
POINT pt;
|
if (!hWnd)
|
||||||
GetCursorPos(&pt);
|
{
|
||||||
int idMenu = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
|
ShowError(IDS_ERR_WND);
|
||||||
if (idMenu == ID_POPUPMENU_HELP && !pressed)
|
return FALSE;
|
||||||
{
|
}
|
||||||
pressed = TRUE;
|
|
||||||
if (MessageBox(hWnd, szHelp, szTitle, MB_OK | MB_TOPMOST) == IDOK) pressed = FALSE;
|
int nArgs = 0;
|
||||||
}
|
LPWSTR* szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
||||||
if (idMenu == ID_POPUPMENU_EXIT) SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
|
||||||
}
|
diag_log(L"Arguments:", nArgs - 1);
|
||||||
break;
|
for (int i = 1; i < nArgs; i++)
|
||||||
|
{
|
||||||
case WM_DESTROY:
|
diag_log(L"Argument", i, L":", szArglist[i]);
|
||||||
if (KeyboardHook) UnhookWindowsHookEx(KeyboardHook);
|
}
|
||||||
if (hMenu) DestroyMenu(hMenu);
|
|
||||||
Shell_NotifyIcon(NIM_DELETE, &nid);
|
(nArgs >= 2 && 0 == lstrcmpiW(szArglist[1], L"/hide")) ? bShowIcon = FALSE : bShowIcon = TRUE;
|
||||||
PostQuitMessage(0);
|
LocalFree(szArglist);
|
||||||
break;
|
HandlingTrayIcon();
|
||||||
|
|
||||||
default:
|
hHeap = GetProcessHeap();
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
szBuffer = HeapAlloc(hHeap, HEAP_ZERO_MEMORY, BUF_LEN);
|
||||||
}
|
|
||||||
return 0;
|
hTaskBar = FindWindowW(L"Shell_TrayWnd", NULL);
|
||||||
}
|
hProgman = FindWindowW(L"Progman", NULL);
|
||||||
|
hDesktop = GetDesktopWindow();
|
||||||
LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
MSG msg;
|
||||||
pkhs = (KBDLLHOOKSTRUCT*)lParam;
|
BOOL bRet;
|
||||||
|
|
||||||
if (wParam == WM_KEYUP)
|
while ((bRet = GetMessageW(&msg, NULL, 0, 0)) != 0)
|
||||||
{
|
{
|
||||||
if (pkhs->vkCode == VK_LCONTROL) bLCTRL = FALSE;
|
if (bRet == -1)
|
||||||
if (pkhs->vkCode == VK_LWIN) bLWIN = FALSE;
|
{
|
||||||
pressed = FALSE;
|
ShowError(IDS_ERR_MAIN);
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
if (wParam == WM_KEYDOWN)
|
else
|
||||||
{
|
{
|
||||||
if (pkhs->vkCode == VK_LCONTROL) bLCTRL = TRUE;
|
TranslateMessage(&msg);
|
||||||
if (pkhs->vkCode == VK_LWIN) bLWIN = TRUE;
|
DispatchMessageW(&msg);
|
||||||
|
}
|
||||||
if (bLCTRL && bLWIN && pkhs->vkCode == 0x49 && !pressed) // 'I' key
|
}
|
||||||
{
|
|
||||||
pressed = TRUE;
|
if (hMouseHook) UnhookWindowsHookEx(hMouseHook);
|
||||||
showIcon = !showIcon;
|
if (hKbdHook) UnhookWindowsHookEx(hKbdHook);
|
||||||
if (showIcon)
|
if (hMenu) DestroyMenu(hMenu);
|
||||||
{
|
Shell_NotifyIconW(NIM_DELETE, &nid);
|
||||||
if (!CreateTrayIcon())
|
|
||||||
{
|
diag_log(L"Quiting WinMain(), msg.wParam =", (int)msg.wParam);
|
||||||
ShowError(GetModuleHandle(NULL), IDS_ERR_ICON);
|
CloseLogFile();
|
||||||
showIcon = FALSE;
|
HeapFree(hHeap, NULL, szBuffer);
|
||||||
}
|
|
||||||
}
|
return (int)msg.wParam;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
Shell_NotifyIcon(NIM_DELETE, &nid);
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
{
|
||||||
}
|
switch (message)
|
||||||
|
{
|
||||||
if (bLCTRL && bLWIN && pkhs->vkCode == 0x43 && !pressed) // 'C' key
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
pressed = TRUE;
|
hMenu = LoadMenuW(hInst, MAKEINTRESOURCE(IDR_MENU));
|
||||||
HWND fgWindow = GetForegroundWindow();
|
if (!hMenu)
|
||||||
if (fgWindow)
|
{
|
||||||
{
|
diag_log(L"Loading context menu failed!");
|
||||||
HWND parentWindow = fgWindow;
|
ShowError(IDS_ERR_MENU);
|
||||||
while (TRUE)
|
SendMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
||||||
{
|
}
|
||||||
parentWindow = GetParent(fgWindow);
|
diag_log(L"Context menu successfully loaded");
|
||||||
if (parentWindow) fgWindow = parentWindow;
|
|
||||||
else break;
|
hPopup = GetSubMenu(hMenu, 0);
|
||||||
}
|
if (!hPopup)
|
||||||
WINDOWPLACEMENT wp = { 0 };
|
{
|
||||||
wp.length = sizeof(WINDOWPLACEMENT);
|
diag_log(L"Creating popup menu failed!");
|
||||||
GetWindowPlacement(fgWindow, &wp);
|
ShowError(IDS_ERR_POPUP);
|
||||||
if (wp.showCmd == SW_SHOWNORMAL)
|
SendMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
||||||
{
|
}
|
||||||
int fgW = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
|
diag_log(L"Popup menu successfully created");
|
||||||
int fgH = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
|
|
||||||
int fgX = dtCenterX - (fgW / 2);
|
mii.cbSize = sizeof(MENUITEMINFO);
|
||||||
int fgY = dtCenterY - (fgH / 2);
|
mii.fMask = MIIM_STATE;
|
||||||
wp.rcNormalPosition.left = fgX;
|
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
||||||
wp.rcNormalPosition.top = fgY;
|
SetMenuItemInfoW(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
||||||
wp.rcNormalPosition.right = fgX + fgW;
|
|
||||||
wp.rcNormalPosition.bottom = fgY + fgH;
|
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
||||||
SendMessage(fgWindow, WM_ENTERSIZEMOVE, NULL, NULL);
|
nid.hWnd = hWnd;
|
||||||
SetWindowPlacement(fgWindow, &wp);
|
nid.uVersion = NOTIFYICON_VERSION;
|
||||||
SendMessage(fgWindow, WM_EXITSIZEMOVE, NULL, NULL);
|
nid.uCallbackMessage = WM_WCW;
|
||||||
}
|
nid.hIcon = hIcon;
|
||||||
}
|
nid.uID = IDI_TRAYICON;
|
||||||
}
|
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||||
}
|
nid.dwInfoFlags = NIIF_NONE;
|
||||||
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
nid.dwState = NIS_HIDDEN;
|
||||||
}
|
nid.dwStateMask = NIS_HIDDEN;
|
||||||
|
StringCchCopyW(nid.szTip, _countof(nid.szTip), szTitle);
|
||||||
BOOL CreateTrayIcon()
|
|
||||||
{
|
hMouseHook = SetWindowsHookExW(WH_MOUSE_LL, MouseHookProc, hInst, NULL);
|
||||||
nid.cbSize = sizeof(NOTIFYICONDATA);
|
if (!hMouseHook)
|
||||||
nid.hWnd = hWnd;
|
{
|
||||||
nid.uVersion = NOTIFYICON_VERSION;
|
diag_log(L"Creating mouse hook failed!");
|
||||||
nid.uCallbackMessage = WM_WCW;
|
ShowError(IDS_ERR_HOOK);
|
||||||
nid.hIcon = hIcon;
|
SendMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
||||||
nid.uID = IDI_TRAYICON;
|
}
|
||||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
diag_log(L"Mouse hook was successfully set");
|
||||||
nid.dwInfoFlags = NIIF_INFO;
|
|
||||||
StringCchCopy(nid.szTip, sizeof(nid.szTip), szTitle);
|
hKbdHook = SetWindowsHookExW(WH_KEYBOARD_LL, KeyboardHookProc, hInst, NULL);
|
||||||
return Shell_NotifyIcon(NIM_ADD, &nid);
|
if (!hKbdHook)
|
||||||
}
|
{
|
||||||
|
diag_log(L"Creating keyboard hook failed!");
|
||||||
VOID ShowError(HINSTANCE hInstance, UINT uID)
|
ShowError(IDS_ERR_HOOK);
|
||||||
{
|
SendMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
||||||
WCHAR szErrorText[MAX_LOADSTRING]; // Текст ошибки
|
}
|
||||||
LoadStringW(hInstance, uID, szErrorText, MAX_LOADSTRING);
|
diag_log(L"Keyboard hook was successfully set");
|
||||||
MessageBox(hWnd, szErrorText, szTitle, MB_OK | MB_ICONERROR);
|
|
||||||
}
|
LoadStringW(hInst, IDS_ABOUT, szAbout, _countof(szAbout));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_WCW:
|
||||||
|
{
|
||||||
|
if ((lParam == WM_RBUTTONDOWN || lParam == WM_LBUTTONDOWN) && wParam == IDI_TRAYICON)
|
||||||
|
{
|
||||||
|
SetForegroundWindow(hWnd);
|
||||||
|
POINT pt;
|
||||||
|
GetCursorPos(&pt);
|
||||||
|
int idMenu = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
|
||||||
|
if (idMenu == ID_POPUPMENU_ICON)
|
||||||
|
{
|
||||||
|
bShowIcon = FALSE;
|
||||||
|
HandlingTrayIcon();
|
||||||
|
}
|
||||||
|
if (idMenu == ID_POPUPMENU_AREA)
|
||||||
|
{
|
||||||
|
bWorkArea = !bWorkArea;
|
||||||
|
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
||||||
|
SetMenuItemInfoW(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
||||||
|
diag_log(L"Changed 'Use workarea' option to", bWorkArea);
|
||||||
|
}
|
||||||
|
if (idMenu == ID_POPUPMENU_ABOUT && !bKPressed)
|
||||||
|
{
|
||||||
|
bKPressed = TRUE;
|
||||||
|
diag_log(L"Opening 'About' dialog");
|
||||||
|
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)About);
|
||||||
|
bKPressed = FALSE;
|
||||||
|
}
|
||||||
|
if (idMenu == ID_POPUPMENU_EXIT) SendMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
{
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return DefWindowProcW(hWnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if (wParam == WM_MBUTTONUP) bMPressed = FALSE;
|
||||||
|
if (wParam == WM_MBUTTONDOWN && bLCTRL && bLWIN && !bMPressed)
|
||||||
|
{
|
||||||
|
diag_log(L"Pressed LCTRL + LWIN + MMB");
|
||||||
|
bMPressed = TRUE;
|
||||||
|
hFgWnd = GetForegroundWindow();
|
||||||
|
BOOL bApproved = CheckWindow(hFgWnd);
|
||||||
|
if (bApproved) MoveWindowToMonitorCenter(hFgWnd, bWorkArea, FALSE);
|
||||||
|
else hFgWnd = NULL;
|
||||||
|
}
|
||||||
|
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
pkhs = (KBDLLHOOKSTRUCT*)lParam;
|
||||||
|
|
||||||
|
if (wParam == WM_KEYUP)
|
||||||
|
{
|
||||||
|
if (pkhs->vkCode == VK_LCONTROL) bLCTRL = FALSE;
|
||||||
|
if (pkhs->vkCode == VK_LWIN) bLWIN = FALSE;
|
||||||
|
bKPressed = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wParam == WM_KEYDOWN)
|
||||||
|
{
|
||||||
|
if (pkhs->vkCode == VK_LCONTROL) bLCTRL = TRUE;
|
||||||
|
if (pkhs->vkCode == VK_LWIN) bLWIN = TRUE;
|
||||||
|
|
||||||
|
if (bLCTRL && bLWIN && pkhs->vkCode == KEY_I && !bKPressed) // 'I' key
|
||||||
|
{
|
||||||
|
diag_log(L"Pressed LCTRL + LWIN + I");
|
||||||
|
bKPressed = TRUE;
|
||||||
|
bShowIcon = !bShowIcon;
|
||||||
|
HandlingTrayIcon();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bLCTRL && bLWIN && pkhs->vkCode == KEY_C && !bKPressed && !bKEYV) // 'C' key
|
||||||
|
{
|
||||||
|
diag_log(L"Pressed LCTRL + LWIN + C");
|
||||||
|
bKPressed = TRUE;
|
||||||
|
hFgWnd = GetForegroundWindow();
|
||||||
|
BOOL bApproved = CheckWindow(hFgWnd);
|
||||||
|
if (bApproved) MoveWindowToMonitorCenter(hFgWnd, bWorkArea, FALSE);
|
||||||
|
else hFgWnd = NULL;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bLCTRL && bLWIN && pkhs->vkCode == KEY_V && !bKPressed && !bKEYV) // 'V' key
|
||||||
|
{
|
||||||
|
diag_log(L"Pressed LCTRL + LWIN + V");
|
||||||
|
bKPressed = TRUE; bKEYV = TRUE;
|
||||||
|
hFgWnd = GetForegroundWindow();
|
||||||
|
BOOL bApproved = CheckWindow(hFgWnd);
|
||||||
|
if (bApproved)
|
||||||
|
{
|
||||||
|
diag_log(L"Opening 'Manual editing' dialog");
|
||||||
|
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_MANUAL_EDITING), hFgWnd, (DLGPROC)DlgProc);
|
||||||
|
SetForegroundWindow(hFgWnd);
|
||||||
|
}
|
||||||
|
else hFgWnd = NULL;
|
||||||
|
bKEYV = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK DlgProc(HWND hDlg, UINT dlgmsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
switch (dlgmsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
SetWindowTextW(hDlg, szTitle);
|
||||||
|
GetWindowTextW(hFgWnd, szWinTitle, _countof(szWinTitle));
|
||||||
|
GetClassNameW(hFgWnd, szWinClass, _countof(szWinClass));
|
||||||
|
GetWindowRect(hFgWnd, &rcFW);
|
||||||
|
x = rcFW.left;
|
||||||
|
y = rcFW.top;
|
||||||
|
w = rcFW.right - rcFW.left;
|
||||||
|
h = rcFW.bottom - rcFW.top;
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_X, x, TRUE);
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_Y, y, TRUE);
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_WIDTH, w, FALSE);
|
||||||
|
SetDlgItemInt(hDlg, IDC_EDIT_HEIGHT, h, FALSE);
|
||||||
|
SetDlgItemTextW(hDlg, IDC_EDIT_TITLE, szWinTitle);
|
||||||
|
SetDlgItemTextW(hDlg, IDC_EDIT_CLASS, szWinClass);
|
||||||
|
UpdateWindow(hDlg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_BUTTON_SET:
|
||||||
|
{
|
||||||
|
x = GetDlgItemInt(hDlg, IDC_EDIT_X, NULL, TRUE);
|
||||||
|
y = GetDlgItemInt(hDlg, IDC_EDIT_Y, NULL, TRUE);
|
||||||
|
w = GetDlgItemInt(hDlg, IDC_EDIT_WIDTH, NULL, FALSE);
|
||||||
|
h = GetDlgItemInt(hDlg, IDC_EDIT_HEIGHT, NULL, FALSE);
|
||||||
|
SendMessageW(hFgWnd, WM_ENTERSIZEMOVE, NULL, NULL);
|
||||||
|
MoveWindow(hFgWnd, x, y, w, h, TRUE);
|
||||||
|
SendMessageW(hFgWnd, WM_EXITSIZEMOVE, NULL, NULL);
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IDCANCEL:
|
||||||
|
case IDC_BUTTON_CLOSE:
|
||||||
|
{
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
diag_log(L"Closing 'Manual editing' dialog");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CheckWindow(HWND hFW)
|
||||||
|
{
|
||||||
|
diag_log(L"Entering CheckWindow(), hwnd=", hFW);
|
||||||
|
GetClassNameW(hFW, szWinClass, _countof(szWinClass));
|
||||||
|
if (hFW)
|
||||||
|
{
|
||||||
|
if (wcscmp(szWinClass, szWinCore) != 0)
|
||||||
|
{
|
||||||
|
if (hFW != hDesktop && hFW != hTaskBar && hFW != hProgman)
|
||||||
|
{
|
||||||
|
if (!IsIconic(hFW) && !IsZoomed(hFW))
|
||||||
|
{
|
||||||
|
GetWindowTextW(hFW, (LPWSTR)szBuffer, BUF_LEN - sizeof(WCHAR));
|
||||||
|
diag_log(L"Window with hwnd=", hFW, L"is approved");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else ShowError(IDS_ERR_MAXMIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diag_log(L"Window with hwnd=", hFW, L"is not approved!");
|
||||||
|
diag_log(L"Quiting CheckWindow()");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID HandlingTrayIcon()
|
||||||
|
{
|
||||||
|
diag_log(L"Entering HandlingTrayIcon(), bShowIcon =", bShowIcon);
|
||||||
|
if (bShowIcon)
|
||||||
|
{
|
||||||
|
BOOL bResult1 = Shell_NotifyIconW(NIM_ADD, &nid);
|
||||||
|
diag_log(L"Shell_NotifyIconW(NIM_ADD):", bResult1);
|
||||||
|
BOOL bResult2 = Shell_NotifyIconW(NIM_SETVERSION, &nid);
|
||||||
|
diag_log(L"Shell_NotifyIconW(NIM_SETVERSION):", bResult2);
|
||||||
|
if (!bResult1 || !bResult2)
|
||||||
|
{
|
||||||
|
diag_log(L"Error creating trayicon.");
|
||||||
|
ShowError(IDS_ERR_ICON);
|
||||||
|
bShowIcon = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Shell_NotifyIconW(NIM_DELETE, &nid);
|
||||||
|
}
|
||||||
|
diag_log(L"Quiting HandlingTrayIcon()");
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID ShowError(UINT uID)
|
||||||
|
{
|
||||||
|
WCHAR szErrorText[MAX_LOADSTRING]; // Error's text
|
||||||
|
LoadStringW(hInst, uID, szErrorText, _countof(szErrorText));
|
||||||
|
MessageBoxW(hWnd, szErrorText, szTitle, MB_OK | MB_ICONERROR | MB_TOPMOST);
|
||||||
|
}
|
||||||
|
|
||||||
|
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
INITCOMMONCONTROLSEX icex = { 0 };
|
||||||
|
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||||
|
icex.dwICC = ICC_LINK_CLASS;
|
||||||
|
InitCommonControlsEx(&icex);
|
||||||
|
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
SetDlgItemTextW(hDlg, IDC_ABOUTHELP, szAbout);
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
LPNMHDR pNMHdr = (LPNMHDR)lParam;
|
||||||
|
if ((NM_CLICK == pNMHdr->code || NM_RETURN == pNMHdr->code) && IDC_DONATIONLINK == pNMHdr->idFrom)
|
||||||
|
{
|
||||||
|
PNMLINK pNMLink = (PNMLINK)pNMHdr;
|
||||||
|
LITEM item = pNMLink->item;
|
||||||
|
ShellExecuteW(NULL, L"open", item.szUrl, NULL, NULL, SW_SHOW);
|
||||||
|
diag_log(L"Pressed donation link");
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||||
|
{
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
|
diag_log(L"Closing 'About' dialog");
|
||||||
|
return (INT_PTR)TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (INT_PTR)FALSE;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|||||||
48
wCenterWindow/wCenterWindow.manifest
Normal file
48
wCenterWindow/wCenterWindow.manifest
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
|
||||||
|
<description>Centers windows by hotkey (C++)</description>
|
||||||
|
|
||||||
|
<assemblyIdentity
|
||||||
|
version="2.3.3.0"
|
||||||
|
processorArchitecture="x86"
|
||||||
|
name="W0LF.wCenterWindow.C++"
|
||||||
|
type="win32">
|
||||||
|
</assemblyIdentity>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="Win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
processorArchitecture="*"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!--ID Windows Vista -->
|
||||||
|
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||||
|
<!--ID Windows 7 -->
|
||||||
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||||
|
<!--ID Windows 8 -->
|
||||||
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||||
|
<!--ID Windows 8.1 -->
|
||||||
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
|
<!--ID Windows 10 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges>
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
|
||||||
|
</assembly>
|
||||||
Binary file not shown.
@@ -1,173 +1,183 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
<ProjectGuid>{6A775901-6C34-4E96-B359-C11C76A520BB}</ProjectGuid>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<ProjectGuid>{f1a1603a-f5d0-47b8-8e4b-cf17747bcfba}</ProjectGuid>
|
||||||
<RootNamespace>wCenterWindow</RootNamespace>
|
<RootNamespace>wCenterWindow</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
<XPDeprecationWarning>false</XPDeprecationWarning>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
</PropertyGroup>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
</PropertyGroup>
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
</PropertyGroup>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
</PropertyGroup>
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
</PropertyGroup>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
</PropertyGroup>
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
</PropertyGroup>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
</PropertyGroup>
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
</ImportGroup>
|
<ImportGroup Label="ExtensionSettings">
|
||||||
<ImportGroup Label="Shared">
|
</ImportGroup>
|
||||||
</ImportGroup>
|
<ImportGroup Label="Shared">
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
</ImportGroup>
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
</ImportGroup>
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
</ImportGroup>
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
</ImportGroup>
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
</ImportGroup>
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
</ImportGroup>
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
</ImportGroup>
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
</ImportGroup>
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<PropertyGroup Label="UserMacros" />
|
</ImportGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Label="UserMacros" />
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
</PropertyGroup>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
</PropertyGroup>
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
</PropertyGroup>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<CopyCppRuntimeToOutputDir>false</CopyCppRuntimeToOutputDir>
|
||||||
<LinkIncremental>false</LinkIncremental>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<LinkIncremental>false</LinkIncremental>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<ClCompile>
|
</PropertyGroup>
|
||||||
<PrecompiledHeader>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
</PrecompiledHeader>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<SDLCheck>true</SDLCheck>
|
||||||
<SDLCheck>true</SDLCheck>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<ConformanceMode>false</ConformanceMode>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
<AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</ItemDefinitionGroup>
|
</Link>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<Manifest>
|
||||||
<ClCompile>
|
<AdditionalManifestFiles>$(ProjectName).manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||||
<PrecompiledHeader>
|
</Manifest>
|
||||||
</PrecompiledHeader>
|
</ItemDefinitionGroup>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Optimization>Disabled</Optimization>
|
<ClCompile>
|
||||||
<SDLCheck>true</SDLCheck>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
</ClCompile>
|
<SDLCheck>true</SDLCheck>
|
||||||
<Link>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SubSystem>Windows</SubSystem>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</Link>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
</ItemDefinitionGroup>
|
</ClCompile>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<Link>
|
||||||
<ClCompile>
|
<SubSystem>Windows</SubSystem>
|
||||||
<PrecompiledHeader>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
</PrecompiledHeader>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
</Link>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<Manifest>
|
||||||
<SDLCheck>true</SDLCheck>
|
<AdditionalManifestFiles>$(ProjectName).manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
</Manifest>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
</ItemDefinitionGroup>
|
||||||
<DebugInformationFormat>None</DebugInformationFormat>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
</ClCompile>
|
<ClCompile>
|
||||||
<Link>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SDLCheck>true</SDLCheck>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<AssemblyDebug>false</AssemblyDebug>
|
</ClCompile>
|
||||||
</Link>
|
<Link>
|
||||||
</ItemDefinitionGroup>
|
<SubSystem>Windows</SubSystem>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<ClCompile>
|
<AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<PrecompiledHeader>
|
</Link>
|
||||||
</PrecompiledHeader>
|
</ItemDefinitionGroup>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<ClCompile>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<SDLCheck>true</SDLCheck>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<Link>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<SubSystem>Windows</SubSystem>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
</ClCompile>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<SubSystem>Windows</SubSystem>
|
||||||
</Link>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
</ItemDefinitionGroup>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<ItemGroup>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<ClInclude Include="framework.h" />
|
<AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ClInclude Include="resource.h" />
|
</Link>
|
||||||
<ClInclude Include="targetver.h" />
|
</ItemDefinitionGroup>
|
||||||
<ClInclude Include="wCenterWindow.h" />
|
<ItemGroup>
|
||||||
</ItemGroup>
|
<ClInclude Include="framework.h" />
|
||||||
<ItemGroup>
|
<ClInclude Include="Logger.h" />
|
||||||
<ClCompile Include="wCenterWindow.cpp" />
|
<ClInclude Include="Resource.h" />
|
||||||
</ItemGroup>
|
<ClInclude Include="targetver.h" />
|
||||||
<ItemGroup>
|
<ClInclude Include="wCenterWindow.h" />
|
||||||
<ResourceCompile Include="wCenterWindow.rc" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<ClCompile Include="Logger.cpp" />
|
||||||
<Image Include="wCenterWindow.ico" />
|
<ClCompile Include="wCenterWindow.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<ItemGroup>
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ResourceCompile Include="wCenterWindow.rc" />
|
||||||
</ImportGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="small.ico" />
|
||||||
|
<Image Include="wCenterWindow.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Manifest Include="wCenterWindow.manifest" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,46 +1,60 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Исходные файлы">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Файлы заголовков">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Файлы ресурсов">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="framework.h">
|
<ClInclude Include="framework.h">
|
||||||
<Filter>Файлы заголовков</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="targetver.h">
|
<ClInclude Include="targetver.h">
|
||||||
<Filter>Файлы заголовков</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="wCenterWindow.h">
|
<ClInclude Include="Resource.h">
|
||||||
<Filter>Файлы заголовков</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="resource.h">
|
<ClInclude Include="wCenterWindow.h">
|
||||||
<Filter>Файлы заголовков</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
<ClInclude Include="Logger.h">
|
||||||
<ItemGroup>
|
<Filter>Header Files</Filter>
|
||||||
<ClCompile Include="wCenterWindow.cpp">
|
</ClInclude>
|
||||||
<Filter>Исходные файлы</Filter>
|
</ItemGroup>
|
||||||
</ClCompile>
|
<ItemGroup>
|
||||||
</ItemGroup>
|
<ClCompile Include="wCenterWindow.cpp">
|
||||||
<ItemGroup>
|
<Filter>Source Files</Filter>
|
||||||
<ResourceCompile Include="wCenterWindow.rc">
|
</ClCompile>
|
||||||
<Filter>Файлы ресурсов</Filter>
|
<ClCompile Include="Logger.cpp">
|
||||||
</ResourceCompile>
|
<Filter>Source Files</Filter>
|
||||||
</ItemGroup>
|
</ClCompile>
|
||||||
<ItemGroup>
|
</ItemGroup>
|
||||||
<Image Include="wCenterWindow.ico">
|
<ItemGroup>
|
||||||
<Filter>Файлы ресурсов</Filter>
|
<ResourceCompile Include="wCenterWindow.rc">
|
||||||
</Image>
|
<Filter>Resource Files</Filter>
|
||||||
</ItemGroup>
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="small.ico">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="wCenterWindow.ico">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Manifest Include="wCenterWindow.manifest">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Manifest>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
7
wCenterWindow/wCenterWindow.vcxproj.user
Normal file
7
wCenterWindow/wCenterWindow.vcxproj.user
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LocalDebuggerCommandArguments>/test1 /test2</LocalDebuggerCommandArguments>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user