mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-12-20 02:19:57 +08:00
Everything support
This commit is contained in:
@@ -32,7 +32,7 @@ static WCHAR filePathBuffer[MAX_PATH] = {'\0'};
|
|||||||
|
|
||||||
#define SHARED_MEM_NAME L"QUICKLOOK_WOW64HOOKHELPER_MEM"
|
#define SHARED_MEM_NAME L"QUICKLOOK_WOW64HOOKHELPER_MEM"
|
||||||
|
|
||||||
void DialogHook::GetSelectedFromCommonDialog(PWCHAR buffer)
|
void DialogHook::GetSelected(PWCHAR buffer)
|
||||||
{
|
{
|
||||||
auto hwndfg = GetForegroundWindow();
|
auto hwndfg = GetForegroundWindow();
|
||||||
DWORD pid = 0;
|
DWORD pid = 0;
|
||||||
@@ -67,7 +67,7 @@ void DialogHook::GetSelectedFromCommonDialog(PWCHAR buffer)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SendMessage(hwndfg, WM_HOOK_NOTIFY, 0, 0);
|
SendMessage(hwndfg, WM_HOOK_NOTIFY, 0, 0);
|
||||||
wcscpy_s(buffer, wcslen(buffer) - 1, filePathBuffer);
|
wcscpy_s(buffer, MAX_PATH, filePathBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
class DialogHook
|
class DialogHook
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void GetSelectedFromCommonDialog(PWCHAR buffer);
|
static void GetSelected(PWCHAR buffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void getSelectedInternal(CComPtr<IShellBrowser> psb, PWCHAR buffer);
|
static void getSelectedInternal(CComPtr<IShellBrowser> psb, PWCHAR buffer);
|
||||||
|
|||||||
61
QuickLook.Native/QuickLook.Native32/Everything.cpp
Normal file
61
QuickLook.Native/QuickLook.Native32/Everything.cpp
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
// Copyright <20> 2017 Paddy Xu
|
||||||
|
//
|
||||||
|
// This file is part of QuickLook program.
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Everything.h"
|
||||||
|
|
||||||
|
#define EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASSW L"EVERYTHING"
|
||||||
|
#define EVERYTHING_IPC_ID_FILE_COPY_FULL_PATH_AND_NAME 41007
|
||||||
|
|
||||||
|
void Everything::GetSelected(PWCHAR buffer)
|
||||||
|
{
|
||||||
|
if (SendMessage(
|
||||||
|
FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASSW, nullptr),
|
||||||
|
WM_COMMAND,
|
||||||
|
MAKEWPARAM(EVERYTHING_IPC_ID_FILE_COPY_FULL_PATH_AND_NAME, 0),
|
||||||
|
0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
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 p = wcsstr(pText, L"\r\n");
|
||||||
|
auto l = p == nullptr ? wcslen(pText) : p - pText;
|
||||||
|
wcsncpy_s(buffer, MAX_PATH, pText, l);
|
||||||
|
|
||||||
|
GlobalUnlock(hData);
|
||||||
|
|
||||||
|
CloseClipboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Everything::backupClipboard()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void Everything::restoreClipboard()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
27
QuickLook.Native/QuickLook.Native32/Everything.h
Normal file
27
QuickLook.Native/QuickLook.Native32/Everything.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// Copyright <20> 2017 Paddy Xu
|
||||||
|
//
|
||||||
|
// This file is part of QuickLook program.
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
class Everything
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void GetSelected(PWCHAR buffer);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void backupClipboard();
|
||||||
|
static void restoreClipboard();
|
||||||
|
};
|
||||||
@@ -83,6 +83,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="DialogHook.h" />
|
<ClInclude Include="DialogHook.h" />
|
||||||
|
<ClInclude Include="Everything.h" />
|
||||||
<ClInclude Include="HelperMethods.h" />
|
<ClInclude Include="HelperMethods.h" />
|
||||||
<ClInclude Include="WoW64HookHelper.h" />
|
<ClInclude Include="WoW64HookHelper.h" />
|
||||||
<ClInclude Include="Shell32.h" />
|
<ClInclude Include="Shell32.h" />
|
||||||
@@ -99,6 +100,7 @@
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Everything.cpp" />
|
||||||
<ClCompile Include="HelperMethods.cpp" />
|
<ClCompile Include="HelperMethods.cpp" />
|
||||||
<ClCompile Include="DllExport.cpp" />
|
<ClCompile Include="DllExport.cpp" />
|
||||||
<ClCompile Include="Shell32.cpp" />
|
<ClCompile Include="Shell32.cpp" />
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
<ClInclude Include="HelperMethods.h">
|
<ClInclude Include="HelperMethods.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Everything.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
@@ -56,5 +59,8 @@
|
|||||||
<ClCompile Include="DllExport.cpp">
|
<ClCompile Include="DllExport.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Everything.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -20,13 +20,12 @@
|
|||||||
#include "Shell32.h"
|
#include "Shell32.h"
|
||||||
#include "HelperMethods.h"
|
#include "HelperMethods.h"
|
||||||
#include "DialogHook.h"
|
#include "DialogHook.h"
|
||||||
|
#include "Everything.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Shell32::FocusedWindowType Shell32::GetFocusedWindowType()
|
Shell32::FocusedWindowType Shell32::GetFocusedWindowType()
|
||||||
{
|
{
|
||||||
auto type = INVALID;
|
|
||||||
|
|
||||||
auto hwndfg = GetForegroundWindow();
|
auto hwndfg = GetForegroundWindow();
|
||||||
|
|
||||||
if (HelperMethods::IsCursorActivated(hwndfg))
|
if (HelperMethods::IsCursorActivated(hwndfg))
|
||||||
@@ -35,27 +34,31 @@ Shell32::FocusedWindowType Shell32::GetFocusedWindowType()
|
|||||||
WCHAR classBuffer[MAX_PATH] = {'\0'};
|
WCHAR classBuffer[MAX_PATH] = {'\0'};
|
||||||
if (SUCCEEDED(GetClassName(hwndfg, classBuffer, MAX_PATH)))
|
if (SUCCEEDED(GetClassName(hwndfg, classBuffer, MAX_PATH)))
|
||||||
{
|
{
|
||||||
|
if (wcscmp(classBuffer, L"EVERYTHING") == 0)
|
||||||
|
{
|
||||||
|
return EVERYTHING;
|
||||||
|
}
|
||||||
if (wcscmp(classBuffer, L"WorkerW") == 0 || wcscmp(classBuffer, L"Progman") == 0)
|
if (wcscmp(classBuffer, L"WorkerW") == 0 || wcscmp(classBuffer, L"Progman") == 0)
|
||||||
{
|
{
|
||||||
if (FindWindowEx(hwndfg, nullptr, L"SHELLDLL_DefView", nullptr) != nullptr)
|
if (FindWindowEx(hwndfg, nullptr, L"SHELLDLL_DefView", nullptr) != nullptr)
|
||||||
{
|
{
|
||||||
type = DESKTOP;
|
return DESKTOP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wcscmp(classBuffer, L"ExploreWClass") == 0 || wcscmp(classBuffer, L"CabinetWClass") == 0)
|
if (wcscmp(classBuffer, L"ExploreWClass") == 0 || wcscmp(classBuffer, L"CabinetWClass") == 0)
|
||||||
{
|
{
|
||||||
type = EXPLORER;
|
return EXPLORER;
|
||||||
}
|
}
|
||||||
else if (wcscmp(classBuffer, L"#32770") == 0)
|
if (wcscmp(classBuffer, L"#32770") == 0)
|
||||||
{
|
{
|
||||||
if (FindWindowEx(hwndfg, nullptr, L"DUIViewWndClassName", nullptr) != nullptr)
|
if (FindWindowEx(hwndfg, nullptr, L"DUIViewWndClassName", nullptr) != nullptr)
|
||||||
{
|
{
|
||||||
type = DIALOG;
|
return DIALOG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shell32::GetCurrentSelection(PWCHAR buffer)
|
void Shell32::GetCurrentSelection(PWCHAR buffer)
|
||||||
@@ -69,7 +72,10 @@ void Shell32::GetCurrentSelection(PWCHAR buffer)
|
|||||||
getSelectedFromExplorer(buffer);
|
getSelectedFromExplorer(buffer);
|
||||||
break;
|
break;
|
||||||
case DIALOG:
|
case DIALOG:
|
||||||
DialogHook::GetSelectedFromCommonDialog(buffer);
|
DialogHook::GetSelected(buffer);
|
||||||
|
break;
|
||||||
|
case EVERYTHING:
|
||||||
|
Everything::GetSelected(buffer);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ class Shell32
|
|||||||
public:
|
public:
|
||||||
enum FocusedWindowType
|
enum FocusedWindowType
|
||||||
{
|
{
|
||||||
INVALID = 0,
|
INVALID,
|
||||||
DESKTOP = 1,
|
DESKTOP,
|
||||||
EXPLORER = 2,
|
EXPLORER,
|
||||||
DIALOG = 3,
|
DIALOG,
|
||||||
|
EVERYTHING,
|
||||||
};
|
};
|
||||||
|
|
||||||
static FocusedWindowType GetFocusedWindowType();
|
static FocusedWindowType GetFocusedWindowType();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\QuickLook.Native32\Everything.cpp" />
|
||||||
<ClCompile Include="..\QuickLook.Native32\HelperMethods.cpp" />
|
<ClCompile Include="..\QuickLook.Native32\HelperMethods.cpp" />
|
||||||
<ClCompile Include="..\QuickLook.Native32\Shell32.cpp" />
|
<ClCompile Include="..\QuickLook.Native32\Shell32.cpp" />
|
||||||
<ClCompile Include="..\QuickLook.Native32\stdafx.cpp">
|
<ClCompile Include="..\QuickLook.Native32\stdafx.cpp">
|
||||||
|
|||||||
@@ -8,5 +8,6 @@
|
|||||||
<ClCompile Include="..\QuickLook.Native32\Shell32.cpp" />
|
<ClCompile Include="..\QuickLook.Native32\Shell32.cpp" />
|
||||||
<ClCompile Include="..\QuickLook.Native32\stdafx.cpp" />
|
<ClCompile Include="..\QuickLook.Native32\stdafx.cpp" />
|
||||||
<ClCompile Include="..\QuickLook.Native32\WoW64HookHelper.cpp" />
|
<ClCompile Include="..\QuickLook.Native32\WoW64HookHelper.cpp" />
|
||||||
|
<ClCompile Include="..\QuickLook.Native32\Everything.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user