There are too many potential coding errors in source code
for example:
https://github.com/end2endzone/ShellAnything/blob/master/src/Win32Clipboard.cpp#L42
static const UINT gFormatDescriptorBinary = RegisterClipboardFormat("Binary");
static const UINT gFormatDescriptorDropEffect = RegisterClipboardFormat("Preferred DropEffect");
it only work right when not define UNICODE. And RegisterClipboardFormatA will convert "Binary" to L"Binary", then call RegisterClipboardFormatW.
To improve compatibility, should write like RegisterClipboardFormatA("Binary"), or RegisterClipboardFormatW(L"Binary"),
or more appropriate: RegisterClipboardFormat(TEXT"Binary"))
I tried to modify a part of the code, but I found that this caused coding confusion in the code.
So I recommend using TCHAR instead of char, _stprintf_s instead of sprintf_s, TEXT("bala") instead of "bala"
#ifdef UNICODE
#define tstring std::wstring
#else
#define tstring std::string
#endif
or more cpp style
typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > tstring;
instead of std::string
(ref: https://stackoverflow.com/questions/36197514/what-is-the-macro-for-stdstring-stdwstring-in-vc)
And define UNICODE and _UNICODE
There are too many potential coding errors in source code
for example:
https://github.com/end2endzone/ShellAnything/blob/master/src/Win32Clipboard.cpp#L42
it only work right when not define
UNICODE. AndRegisterClipboardFormatAwill convert"Binary"toL"Binary", then callRegisterClipboardFormatW.To improve compatibility, should write like
RegisterClipboardFormatA("Binary"), orRegisterClipboardFormatW(L"Binary"),or more appropriate:
RegisterClipboardFormat(TEXT"Binary"))I tried to modify a part of the code, but I found that this caused coding confusion in the code.
So I recommend using
TCHARinstead ofchar,_stprintf_sinstead ofsprintf_s,TEXT("bala")instead of"bala"or more cpp style
typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > tstring;instead of
std::string(ref: https://stackoverflow.com/questions/36197514/what-is-the-macro-for-stdstring-stdwstring-in-vc)
And define
UNICODEand_UNICODE