mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-13 19:19:10 +00:00
Run code cleanup
This commit is contained in:
@@ -20,66 +20,66 @@
|
||||
|
||||
void Everything::GetSelected(PWCHAR buffer)
|
||||
{
|
||||
auto hWinFG = GetForegroundWindow();
|
||||
|
||||
// Everything v1.5 IPC via hidden window.
|
||||
HWND hWinI = FindWindowExW(hWinFG, NULL, EVERYTHING_IPC_HIDDEN_WIN_CLASS, NULL);
|
||||
|
||||
if (hWinI != nullptr) {
|
||||
int pLength = GetWindowTextLength(hWinI);
|
||||
wchar_t* pText = new wchar_t[pLength + 1];
|
||||
GetWindowText(hWinI, pText, pLength + 1);
|
||||
wcsncpy_s(buffer, MAX_PATH_EX, pText, pLength);
|
||||
return; // Success. Clipboard access unnecessary.
|
||||
}
|
||||
auto hWinFG = GetForegroundWindow();
|
||||
|
||||
// Everything v1.5 IPC via hidden window.
|
||||
HWND hWinI = FindWindowExW(hWinFG, NULL, EVERYTHING_IPC_HIDDEN_WIN_CLASS, NULL);
|
||||
|
||||
if (hWinI != nullptr) {
|
||||
int pLength = GetWindowTextLength(hWinI);
|
||||
wchar_t* pText = new wchar_t[pLength + 1];
|
||||
GetWindowText(hWinI, pText, pLength + 1);
|
||||
wcsncpy_s(buffer, MAX_PATH_EX, pText, pLength);
|
||||
return; // Success. Clipboard access unnecessary.
|
||||
}
|
||||
|
||||
HWND hWin = FindWindowW(EVERYTHING_IPC_WINDOW_CLASS, NULL);
|
||||
HWND hWin = FindWindowW(EVERYTHING_IPC_WINDOW_CLASS, NULL);
|
||||
|
||||
if (hWin != nullptr) {
|
||||
// Everything IPC Clipboard
|
||||
SendMessageW(
|
||||
hWin,
|
||||
WM_COMMAND,
|
||||
MAKEWPARAM(EVERYTHING_IPC_COPY_TO_CLIPBOARD, 0),
|
||||
0);
|
||||
if (hWin != nullptr) {
|
||||
// Everything IPC Clipboard
|
||||
SendMessageW(
|
||||
hWin,
|
||||
WM_COMMAND,
|
||||
MAKEWPARAM(EVERYTHING_IPC_COPY_TO_CLIPBOARD, 0),
|
||||
0);
|
||||
|
||||
Sleep(100);
|
||||
|
||||
if (!OpenClipboard(nullptr))
|
||||
return;
|
||||
|
||||
auto hData = GetClipboardData(CF_UNICODETEXT);
|
||||
if (hData == nullptr)
|
||||
return;
|
||||
Sleep(100);
|
||||
|
||||
if (!OpenClipboard(nullptr))
|
||||
return;
|
||||
|
||||
auto hData = GetClipboardData(CF_UNICODETEXT);
|
||||
if (hData == nullptr)
|
||||
return;
|
||||
|
||||
auto pText = static_cast<PWCHAR>(GlobalLock(hData));
|
||||
if (pText == nullptr)
|
||||
return;
|
||||
auto pText = static_cast<PWCHAR>(GlobalLock(hData));
|
||||
if (pText == nullptr)
|
||||
return;
|
||||
|
||||
auto p = wcsstr(pText, L"\r\n");
|
||||
auto l = p == nullptr ? wcslen(pText) : p - pText;
|
||||
wcsncpy_s(buffer, MAX_PATH_EX, pText, l); // Everything supports Long Path
|
||||
|
||||
GlobalUnlock(hData);
|
||||
CloseClipboard();
|
||||
}
|
||||
auto p = wcsstr(pText, L"\r\n");
|
||||
auto l = p == nullptr ? wcslen(pText) : p - pText;
|
||||
wcsncpy_s(buffer, MAX_PATH_EX, pText, l); // Everything supports Long Path
|
||||
|
||||
GlobalUnlock(hData);
|
||||
CloseClipboard();
|
||||
}
|
||||
}
|
||||
|
||||
bool Everything::MatchClass(PWCHAR classBuffer)
|
||||
{
|
||||
WCHAR sMatchC[256] = { '\0' };
|
||||
WCHAR sMatchS[256] = EVERYTHING_IPC_WINDOW_CLASS;
|
||||
size_t iLen = wcslen(sMatchS);
|
||||
wcsncpy_s(sMatchC, classBuffer, iLen);
|
||||
return (0 == wcscmp(sMatchC, sMatchS));
|
||||
WCHAR sMatchC[256] = { '\0' };
|
||||
WCHAR sMatchS[256] = EVERYTHING_IPC_WINDOW_CLASS;
|
||||
size_t iLen = wcslen(sMatchS);
|
||||
wcsncpy_s(sMatchC, classBuffer, iLen);
|
||||
return (0 == wcscmp(sMatchC, sMatchS));
|
||||
}
|
||||
|
||||
void Everything::backupClipboard()
|
||||
{
|
||||
// TODO
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Everything::restoreClipboard()
|
||||
{
|
||||
// TODO
|
||||
// TODO
|
||||
}
|
||||
|
Reference in New Issue
Block a user