GiacomoLaw / Keylogger

A simple keylogger for Windows, Linux and Mac
https://simple-keylogger.github.io/
MIT License
2.06k stars 617 forks source link

Compilation error Win10 MinGW error: 'SM_SYSTEMDOCKED' was not declared in this scope #156

Open sinipelto opened 2 months ago

sinipelto commented 2 months ago

Describe the bug Tried to compile on Windows 10 with MinGW64 but got this win32 api related error:

g++.exe -Wall -Wextra -Wpedantic -mwindows -o main.exe .\klog_main.cpp

.\klog_main.cpp: In function 'int Save(int)': .\klog_main.cpp:142:46: warning: unknown conversion type character 'F' in format [-Wformat=] 142 | strftime(s, sizeof(s), "%FT%X%z", &tm_info); | ^ .\klog_main.cpp: In function 'bool IsSystemBooting()': .\klog_main.cpp:204:33: error: 'SM_SYSTEMDOCKED' was not declared in this scope 204 | return GetSystemMetrics(SM_SYSTEMDOCKED) != 0;

Desktop (please complete the following information):

Additional context Latest source from master => windows/klog_main.cpp

sinipelto commented 2 months ago

As a workaround, I replaced the constant with the actual value:

return GetSystemMetrics(0x2004) != 0;

It complies well and works. However would be nice to figure out why the constant is not defined in compile time.