Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- // include this instead of including Windows.h directly
- #define _WIN32_WINNT 0x0601
- #include <sdkddkver.h>
- #ifndef WINDOWS_FULL
- #define WIN32_LEAN_AND_MEAN
- #define NOGDICAPMASKS
- #define NOSYSMETRICS
- #define NOMENUS
- #define NOICONS
- #define NOSYSCOMMANDS
- #define NORASTEROPS
- #define OEMRESOURCE
- #define NOATOM
- #define NOCLIPBOARD
- #define NOCOLOR
- #define NOCTLMGR
- #define NODRAWTEXT
- #define NOKERNEL
- //#define NONLS
- #define NOMEMMGR
- #define NOMETAFILE
- #define NOOPENFILE
- #define NOSCROLL
- #define NOSERVICE
- #define NOSOUND
- #define NOTEXTMETRIC
- #define NOWH
- #define NOCOMM
- #define NOKANJI
- #define NOHELP
- #define NOPROFILER
- #define NODEFERWINDOWPOS
- #define NOMCX
- #define NORPC
- #define NOPROXYSTUB
- #define NOIMAGE
- #define NOTAPE
- #endif
- #define NOMINMAX
- #define STRICT
- #if defined(_WIN64) || defined(_WIN32)
- #include <Windows.h>
- inline String GetLastErrorStr()
- {
- DWORD errorMessageID = GetLastError();
- if (errorMessageID == 0) return String();
- LPSTR messageBuffer = nullptr;
- size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
- String message(messageBuffer, size);
- LocalFree(messageBuffer);
- return message;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement