mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[New utility]Sysinternals ZoomIt (#35880)
* ZoomIt initial code dump * Change vcxproj to normalize dependency versions * Fix code quality to build * Add to PowerToys solution * Clean out C-style casts * Fix some more analyzer errors * Constexpr a function * Disable some warnings locally that it seemed better not to touch * Add ZoomIt module interface * Add GPO * Add Settings page with Enable button * Output as PowerToys.ZoomIt.exe * Extract ZoomIt Settings definition to its own header * Make ZoomItModuleInterface build with ZoomItSettings too * WinRT C++ interop for ZoomItSettings * From Registry To PowerToys Json * Properly fix const_cast analyzer error * Initial Settings page loading from registry * Zoom mode settings * Save settings * Add file picker and DemoType file support * Remaining DemoType settings * Have ZoomIt properly reloading Settings and exiting * Remove context menu entries for Options and Exit * ZoomIt simple Break Options * Break advanced options * Simple Record settings * Record Microphone setting * Fix break background file picker title * Font setting * Fix build issues after merge * Add ZoomIt conflict warning to Settings * Exclude Eula from spell checking * Fix spellcheck errors * Fix spell check for accelerated menu items * Remove cursor files from spellcheck. They're binary * Fix forbidden patterns * Fix XAML style * Fix C# analyzers * Fix signing * Also sign module interface dll * Use actual ZoomIt icon * Add OOBE page for ZoomIt * ZoomIt image for Settings * Flyout and Dashboard entries * Fix type speed slider labels * Correctly load default Font * Correctly register shortcuts on ZoomIt startup first run * Fix modifier keys not changing until restart * Show MsgBox on taken shortcut * Start PowerToys Settings * Normalize ZoomIt file properties with rest of PowerToys * Add attribution * Add ZoomIt team to Community.md * More copyright adjustments * Fix spellcheck * Fix MsgBox simultaneous instance to the front * Add mention of capturevideosample code use * Add ZoomIt to process lists * Add telemetry * Add logging * React to gpo * Normalize code to space identation * Fix installer build * Localize percent setting * Fix XAML styling * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Fix spellcheck * One more spellcheck fix * Integrate LiveDraw feature changes from upstream * Fix name reuse in same scope * Fix c-style casts * Also register LIVEDRAW_HOTKEY * Fix newLiveZoomToggleKey * Update LiveZoom description in Settings to take LiveDraw into account * Fix spellcheck * Fix more spellcheck * Fix Sysinternals capitalization * Fix ARM64 Debug build * Support Sysinternals build (#36873) * Remove unneeded files * Make build compatible with Sysinternals * Separate PowerToys ZoomIt product name (#36887) * Separate PowerToys ZoomIt product name To help maintain the Sysinternals branding in the standalone version. * Clarify branding-related includes * Remove ZoomIt.sln * Add foxmsft to spell-check names * Add ZoomIt to README * Add ZoomIt to GH templates * Add ZoomIt events to DATA_AND_PRIVACY.md * Remove publish_config.json * Remove publish_config.json from vcxproj too --------- Co-authored-by: Mark Russinovich <markruss@microsoft.com> Co-authored-by: Alex Mihaiuc <69110671+foxmsft@users.noreply.github.com> Co-authored-by: John Stephens <johnstep@microsoft.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
This commit is contained in:
@@ -159,7 +159,7 @@
|
||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets" Condition="Exists('..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets')" />
|
||||
<Import Project="..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets" Condition="Exists('..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
@@ -168,7 +168,7 @@
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -2,5 +2,5 @@
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231216.1" targetFramework="native" />
|
||||
<package id="robmikh.common" version="0.0.22-beta" targetFramework="native" />
|
||||
<package id="robmikh.common" version="0.0.23-beta" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -52,13 +52,13 @@
|
||||
// robmikh.common
|
||||
#include <robmikh.common/composition.interop.h>
|
||||
#include <robmikh.common/direct3d11.interop.h>
|
||||
#include <robmikh.common/d3dHelpers.h>
|
||||
#include <robmikh.common/d3d11Helpers.h>
|
||||
#include <robmikh.common/graphics.interop.h>
|
||||
// robmikh.common needs to be updated to support newer versions of C++/WinRT https://github.com/robmikh/robmikh.common/issues/2
|
||||
// Applying workaround from https://github.com/robmikh/Win32CaptureSample/commit/fc758e343ca886795b05af5003d9a3bb85ff4da2
|
||||
// #include <robmikh.common/dispatcherQueue.desktop.interop.h>
|
||||
#include "DispatcherQueue.desktop.interop.h"
|
||||
#include <robmikh.common/d3dHelpers.desktop.h>
|
||||
#include <robmikh.common/d3d11Helpers.desktop.h>
|
||||
#include <robmikh.common/composition.desktop.interop.h>
|
||||
#include <robmikh.common/hwnd.interop.h>
|
||||
#include <robmikh.common/capture.desktop.interop.h>
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.211019.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.211019.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets" Condition="Exists('..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets')" />
|
||||
<Import Project="..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets" Condition="Exists('..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||
@@ -112,7 +112,7 @@
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\robmikh.common.0.0.22-beta\build\native\robmikh.common.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
168
src/modules/ZoomIt/ZoomIt/AudioSampleGenerator.cpp
Normal file
168
src/modules/ZoomIt/ZoomIt/AudioSampleGenerator.cpp
Normal file
@@ -0,0 +1,168 @@
|
||||
#include "pch.h"
|
||||
#include "AudioSampleGenerator.h"
|
||||
#include "CaptureFrameWait.h"
|
||||
|
||||
extern TCHAR g_MicrophoneDeviceId[];
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Storage;
|
||||
using namespace Windows::Storage::Streams;
|
||||
using namespace Windows::Media;
|
||||
using namespace Windows::Media::Audio;
|
||||
using namespace Windows::Media::Capture;
|
||||
using namespace Windows::Media::Core;
|
||||
using namespace Windows::Media::Render;
|
||||
using namespace Windows::Media::MediaProperties;
|
||||
using namespace Windows::Media::Devices;
|
||||
using namespace Windows::Devices::Enumeration;
|
||||
}
|
||||
|
||||
AudioSampleGenerator::AudioSampleGenerator()
|
||||
{
|
||||
m_audioEvent.create(wil::EventOptions::ManualReset);
|
||||
m_endEvent.create(wil::EventOptions::ManualReset);
|
||||
m_asyncInitialized.create(wil::EventOptions::ManualReset);
|
||||
}
|
||||
|
||||
AudioSampleGenerator::~AudioSampleGenerator()
|
||||
{
|
||||
Stop();
|
||||
if (m_started.load())
|
||||
{
|
||||
m_audioGraph.Close();
|
||||
}
|
||||
}
|
||||
|
||||
winrt::IAsyncAction AudioSampleGenerator::InitializeAsync()
|
||||
{
|
||||
auto expected = false;
|
||||
if (m_initialized.compare_exchange_strong(expected, true))
|
||||
{
|
||||
// Initialize the audio graph
|
||||
auto audioGraphSettings = winrt::AudioGraphSettings(winrt::AudioRenderCategory::Media);
|
||||
auto audioGraphResult = co_await winrt::AudioGraph::CreateAsync(audioGraphSettings);
|
||||
if (audioGraphResult.Status() != winrt::AudioGraphCreationStatus::Success)
|
||||
{
|
||||
throw winrt::hresult_error(E_FAIL, L"Failed to initialize AudioGraph!");
|
||||
}
|
||||
m_audioGraph = audioGraphResult.Graph();
|
||||
|
||||
// Initialize the selected microphone
|
||||
auto defaultMicrophoneId = winrt::MediaDevice::GetDefaultAudioCaptureId(winrt::AudioDeviceRole::Default);
|
||||
auto microphoneId = (g_MicrophoneDeviceId[0] == 0) ? defaultMicrophoneId : winrt::to_hstring(g_MicrophoneDeviceId);
|
||||
auto microphone = co_await winrt::DeviceInformation::CreateFromIdAsync(microphoneId);
|
||||
|
||||
// Initialize audio input and output nodes
|
||||
auto inputNodeResult = co_await m_audioGraph.CreateDeviceInputNodeAsync(winrt::MediaCategory::Media, m_audioGraph.EncodingProperties(), microphone);
|
||||
if (inputNodeResult.Status() != winrt::AudioDeviceNodeCreationStatus::Success && microphoneId != defaultMicrophoneId)
|
||||
{
|
||||
// If the selected microphone failed, try again with the default
|
||||
microphone = co_await winrt::DeviceInformation::CreateFromIdAsync(defaultMicrophoneId);
|
||||
inputNodeResult = co_await m_audioGraph.CreateDeviceInputNodeAsync(winrt::MediaCategory::Media, m_audioGraph.EncodingProperties(), microphone);
|
||||
}
|
||||
if (inputNodeResult.Status() != winrt::AudioDeviceNodeCreationStatus::Success)
|
||||
{
|
||||
throw winrt::hresult_error(E_FAIL, L"Failed to initialize input audio node!");
|
||||
}
|
||||
m_audioInputNode = inputNodeResult.DeviceInputNode();
|
||||
m_audioOutputNode = m_audioGraph.CreateFrameOutputNode();
|
||||
|
||||
// Hookup audio nodes
|
||||
m_audioInputNode.AddOutgoingConnection(m_audioOutputNode);
|
||||
m_audioGraph.QuantumStarted({ this, &AudioSampleGenerator::OnAudioQuantumStarted });
|
||||
|
||||
m_asyncInitialized.SetEvent();
|
||||
}
|
||||
}
|
||||
|
||||
winrt::AudioEncodingProperties AudioSampleGenerator::GetEncodingProperties()
|
||||
{
|
||||
CheckInitialized();
|
||||
return m_audioOutputNode.EncodingProperties();
|
||||
}
|
||||
|
||||
std::optional<winrt::MediaStreamSample> AudioSampleGenerator::TryGetNextSample()
|
||||
{
|
||||
CheckInitialized();
|
||||
CheckStarted();
|
||||
|
||||
{
|
||||
auto lock = m_lock.lock_exclusive();
|
||||
if (m_samples.empty() && m_endEvent.is_signaled())
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
else if (!m_samples.empty())
|
||||
{
|
||||
std::optional result(m_samples.front());
|
||||
m_samples.pop_front();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
m_audioEvent.ResetEvent();
|
||||
std::vector<HANDLE> events = { m_endEvent.get(), m_audioEvent.get() };
|
||||
auto waitResult = WaitForMultipleObjectsEx(static_cast<DWORD>(events.size()), events.data(), false, INFINITE, false);
|
||||
auto eventIndex = -1;
|
||||
switch (waitResult)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
case WAIT_OBJECT_0 + 1:
|
||||
eventIndex = waitResult - WAIT_OBJECT_0;
|
||||
break;
|
||||
}
|
||||
WINRT_VERIFY(eventIndex >= 0);
|
||||
|
||||
auto signaledEvent = events[eventIndex];
|
||||
if (signaledEvent == m_endEvent.get())
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto lock = m_lock.lock_exclusive();
|
||||
std::optional result(m_samples.front());
|
||||
m_samples.pop_front();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioSampleGenerator::Start()
|
||||
{
|
||||
CheckInitialized();
|
||||
auto expected = false;
|
||||
if (m_started.compare_exchange_strong(expected, true))
|
||||
{
|
||||
m_audioGraph.Start();
|
||||
}
|
||||
}
|
||||
|
||||
void AudioSampleGenerator::Stop()
|
||||
{
|
||||
CheckInitialized();
|
||||
if (m_started.load())
|
||||
{
|
||||
m_asyncInitialized.wait();
|
||||
m_audioGraph.Stop();
|
||||
m_endEvent.SetEvent();
|
||||
}
|
||||
}
|
||||
|
||||
void AudioSampleGenerator::OnAudioQuantumStarted(winrt::AudioGraph const& sender, winrt::IInspectable const& args)
|
||||
{
|
||||
{
|
||||
auto lock = m_lock.lock_exclusive();
|
||||
|
||||
auto frame = m_audioOutputNode.GetFrame();
|
||||
std::optional<winrt::TimeSpan> timestamp = frame.RelativeTime();
|
||||
auto audioBuffer = frame.LockBuffer(winrt::AudioBufferAccessMode::Read);
|
||||
|
||||
auto sampleBuffer = winrt::Buffer::CreateCopyFromMemoryBuffer(audioBuffer);
|
||||
sampleBuffer.Length(audioBuffer.Length());
|
||||
auto sample = winrt::MediaStreamSample::CreateFromBuffer(sampleBuffer, timestamp.value());
|
||||
m_samples.push_back(sample);
|
||||
}
|
||||
m_audioEvent.SetEvent();
|
||||
}
|
||||
48
src/modules/ZoomIt/ZoomIt/AudioSampleGenerator.h
Normal file
48
src/modules/ZoomIt/ZoomIt/AudioSampleGenerator.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
class AudioSampleGenerator
|
||||
{
|
||||
public:
|
||||
AudioSampleGenerator();
|
||||
~AudioSampleGenerator();
|
||||
|
||||
winrt::Windows::Foundation::IAsyncAction InitializeAsync();
|
||||
winrt::Windows::Media::MediaProperties::AudioEncodingProperties GetEncodingProperties();
|
||||
|
||||
std::optional<winrt::Windows::Media::Core::MediaStreamSample> TryGetNextSample();
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
void OnAudioQuantumStarted(
|
||||
winrt::Windows::Media::Audio::AudioGraph const& sender,
|
||||
winrt::Windows::Foundation::IInspectable const& args);
|
||||
|
||||
void CheckInitialized()
|
||||
{
|
||||
if (!m_initialized.load())
|
||||
{
|
||||
throw winrt::hresult_error(E_FAIL, L"Must initialize audio sample generator before use!");
|
||||
}
|
||||
}
|
||||
|
||||
void CheckStarted()
|
||||
{
|
||||
if (!m_started.load())
|
||||
{
|
||||
throw winrt::hresult_error(E_FAIL, L"Must start audio sample generator before calling this method!");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
winrt::Windows::Media::Audio::AudioGraph m_audioGraph{ nullptr };
|
||||
winrt::Windows::Media::Audio::AudioDeviceInputNode m_audioInputNode{ nullptr };
|
||||
winrt::Windows::Media::Audio::AudioFrameOutputNode m_audioOutputNode{ nullptr };
|
||||
wil::srwlock m_lock;
|
||||
wil::unique_event m_audioEvent;
|
||||
wil::unique_event m_endEvent;
|
||||
wil::unique_event m_asyncInitialized;
|
||||
std::deque<winrt::Windows::Media::Core::MediaStreamSample> m_samples;
|
||||
std::atomic<bool> m_initialized = false;
|
||||
std::atomic<bool> m_started = false;
|
||||
};
|
||||
147
src/modules/ZoomIt/ZoomIt/CaptureFrameWait.cpp
Normal file
147
src/modules/ZoomIt/ZoomIt/CaptureFrameWait.cpp
Normal file
@@ -0,0 +1,147 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Video capture code derived from https://github.com/robmikh/capturevideosample
|
||||
//
|
||||
//==============================================================================
|
||||
#include "pch.h"
|
||||
#include "CaptureFrameWait.h"
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Graphics;
|
||||
using namespace Windows::Graphics::Capture;
|
||||
using namespace Windows::Graphics::DirectX;
|
||||
using namespace Windows::Graphics::DirectX::Direct3D11;
|
||||
using namespace Windows::Storage;
|
||||
using namespace Windows::UI::Composition;
|
||||
}
|
||||
|
||||
namespace util
|
||||
{
|
||||
using namespace robmikh::common::uwp;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// CaptureFrameWait::CaptureFrameWait
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
CaptureFrameWait::CaptureFrameWait(
|
||||
winrt::IDirect3DDevice const& device,
|
||||
winrt::GraphicsCaptureItem const& item,
|
||||
winrt::SizeInt32 const& size)
|
||||
{
|
||||
m_device = device;
|
||||
m_item = item;
|
||||
|
||||
m_nextFrameEvent = wil::shared_event(wil::EventOptions::ManualReset);
|
||||
m_endEvent = wil::shared_event(wil::EventOptions::ManualReset);
|
||||
m_closedEvent = wil::shared_event(wil::EventOptions::ManualReset);
|
||||
|
||||
m_framePool = winrt::Direct3D11CaptureFramePool::CreateFreeThreaded(
|
||||
m_device,
|
||||
winrt::DirectXPixelFormat::B8G8R8A8UIntNormalized,
|
||||
1,
|
||||
size);
|
||||
m_session = m_framePool.CreateCaptureSession(m_item);
|
||||
|
||||
m_framePool.FrameArrived({ this, &CaptureFrameWait::OnFrameArrived });
|
||||
m_session.StartCapture();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// CaptureFrameWait::~CaptureFrameWait
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
CaptureFrameWait::~CaptureFrameWait()
|
||||
{
|
||||
StopCapture();
|
||||
// We might end the capture before we ever get another frame.
|
||||
m_closedEvent.wait(200);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// CaptureFrameWait::TryGetNextFrame
|
||||
//
|
||||
// Fetches next available frame
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
std::optional<CaptureFrame> CaptureFrameWait::TryGetNextFrame()
|
||||
{
|
||||
if (m_currentFrame != nullptr)
|
||||
{
|
||||
m_currentFrame.Close();
|
||||
}
|
||||
m_nextFrameEvent.ResetEvent();
|
||||
|
||||
std::vector<HANDLE> events = { m_endEvent.get(), m_nextFrameEvent.get() };
|
||||
auto waitResult = WaitForMultipleObjectsEx(static_cast<DWORD>(events.size()), events.data(), false, INFINITE, false);
|
||||
auto eventIndex = -1;
|
||||
switch (waitResult)
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
case WAIT_OBJECT_0 + 1:
|
||||
eventIndex = waitResult - WAIT_OBJECT_0;
|
||||
break;
|
||||
}
|
||||
WINRT_VERIFY(eventIndex >= 0);
|
||||
|
||||
auto signaledEvent = events[eventIndex];
|
||||
if (signaledEvent == m_endEvent.get())
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return std::optional<CaptureFrame>(
|
||||
{
|
||||
m_currentFrame.Surface(),
|
||||
m_currentFrame.ContentSize(),
|
||||
m_currentFrame.SystemRelativeTime(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// CaptureFrameWait::StopCapture
|
||||
//
|
||||
// Stops frame capture and notified any frame waiters
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void CaptureFrameWait::StopCapture()
|
||||
{
|
||||
auto lock = m_lock.lock_exclusive();
|
||||
m_endEvent.SetEvent();
|
||||
m_framePool.Close();
|
||||
m_session.Close();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// CaptureFrameWait::OnFrameArrived
|
||||
//
|
||||
// Callback for new frames
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void CaptureFrameWait::OnFrameArrived(
|
||||
winrt::Direct3D11CaptureFramePool const& sender,
|
||||
winrt::IInspectable const&)
|
||||
{
|
||||
auto lock = m_lock.lock_exclusive();
|
||||
if (m_endEvent.is_signaled())
|
||||
{
|
||||
m_closedEvent.SetEvent();
|
||||
return;
|
||||
}
|
||||
auto frame = sender.TryGetNextFrame();
|
||||
if( frame ) {
|
||||
m_currentFrame = frame;
|
||||
m_nextFrameEvent.SetEvent();
|
||||
}
|
||||
}
|
||||
142
src/modules/ZoomIt/ZoomIt/CaptureFrameWait.h
Normal file
142
src/modules/ZoomIt/ZoomIt/CaptureFrameWait.h
Normal file
@@ -0,0 +1,142 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Video capture code derived from https://github.com/robmikh/capturevideosample
|
||||
//
|
||||
//==============================================================================
|
||||
#pragma once
|
||||
|
||||
// Must come before C++/WinRT
|
||||
#include <wil/cppwinrt.h>
|
||||
|
||||
// WinRT
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.Foundation.Metadata.h>
|
||||
#include <winrt/Windows.Foundation.Numerics.h>
|
||||
#include <winrt/Windows.System.h>
|
||||
#include <winrt/Windows.UI.h>
|
||||
#include <winrt/Windows.UI.Composition.h>
|
||||
#include <winrt/Windows.UI.Composition.Desktop.h>
|
||||
#include <winrt/Windows.UI.Popups.h>
|
||||
#include <winrt/Windows.Graphics.Capture.h>
|
||||
#include <winrt/Windows.Graphics.DirectX.h>
|
||||
#include <winrt/Windows.Graphics.DirectX.Direct3d11.h>
|
||||
#include <winrt/Windows.Media.h>
|
||||
#include <winrt/Windows.Media.Audio.h>
|
||||
#include <winrt/Windows.Media.Core.h>
|
||||
#include <winrt/Windows.Media.Render.h>
|
||||
#include <winrt/Windows.Media.Transcoding.h>
|
||||
#include <winrt/Windows.Media.MediaProperties.h>
|
||||
#include <winrt/Windows.Storage.h>
|
||||
#include <winrt/Windows.Storage.Streams.h>
|
||||
#include <winrt/Windows.Storage.Pickers.h>
|
||||
|
||||
// WIL
|
||||
#include <wil/resource.h>
|
||||
|
||||
// DirectX
|
||||
#include <d3d11_4.h>
|
||||
#include <dxgi1_6.h>
|
||||
#include <d2d1_3.h>
|
||||
#include <wincodec.h>
|
||||
|
||||
// STL
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <array>
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <deque>
|
||||
|
||||
// robmikh.common
|
||||
#include <robmikh.common/composition.interop.h>
|
||||
#include <robmikh.common/direct3d11.interop.h>
|
||||
#include <robmikh.common/d3d11Helpers.h>
|
||||
#include <robmikh.common/graphics.interop.h>
|
||||
#include <robmikh.common/dispatcherQueue.desktop.interop.h>
|
||||
#include <robmikh.common/d3d11Helpers.desktop.h>
|
||||
#include <robmikh.common/composition.desktop.interop.h>
|
||||
#include <robmikh.common/hwnd.interop.h>
|
||||
#include <robmikh.common/capture.desktop.interop.h>
|
||||
#include <robmikh.common/DesktopWindow.h>
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Metadata;
|
||||
using namespace Windows::Graphics;
|
||||
using namespace Windows::Graphics::Capture;
|
||||
using namespace Windows::Graphics::DirectX;
|
||||
using namespace Windows::Graphics::DirectX::Direct3D11;
|
||||
using namespace Windows::Storage;
|
||||
using namespace Windows::UI::Composition;
|
||||
using namespace Windows::Media::Core;
|
||||
using namespace Windows::Media::Transcoding;
|
||||
using namespace Windows::Media::MediaProperties;
|
||||
}
|
||||
|
||||
namespace util
|
||||
{
|
||||
using namespace robmikh::common::uwp;
|
||||
}
|
||||
|
||||
struct CaptureFrame
|
||||
{
|
||||
winrt::Direct3D11::IDirect3DSurface FrameTexture;
|
||||
winrt::SizeInt32 ContentSize;
|
||||
winrt::TimeSpan SystemRelativeTime;
|
||||
};
|
||||
|
||||
class CaptureFrameWait
|
||||
{
|
||||
public:
|
||||
CaptureFrameWait(
|
||||
winrt::Direct3D11::IDirect3DDevice const& device,
|
||||
winrt::GraphicsCaptureItem const& item,
|
||||
winrt::SizeInt32 const& size );
|
||||
~CaptureFrameWait();
|
||||
|
||||
std::optional<CaptureFrame> TryGetNextFrame();
|
||||
void StopCapture();
|
||||
void EnableCursorCapture( bool enable = true )
|
||||
{
|
||||
if( winrt::ApiInformation::IsPropertyPresent( winrt::name_of<decltype(m_session)>(), L"IsCursorCaptureEnabled" ) )
|
||||
{
|
||||
m_session.IsCursorCaptureEnabled( enable );
|
||||
}
|
||||
}
|
||||
void ShowCaptureBorder( bool show = true )
|
||||
{
|
||||
if( winrt::ApiInformation::IsPropertyPresent( winrt::name_of<decltype(m_session)>(), L"IsBorderRequired" ) )
|
||||
{
|
||||
m_session.IsBorderRequired( show );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void OnFrameArrived(
|
||||
winrt::Direct3D11CaptureFramePool const& sender,
|
||||
winrt::IInspectable const& args );
|
||||
|
||||
private:
|
||||
winrt::Direct3D11::IDirect3DDevice m_device{ nullptr };
|
||||
winrt::GraphicsCaptureItem m_item{ nullptr };
|
||||
winrt::Direct3D11CaptureFramePool m_framePool{ nullptr };
|
||||
winrt::GraphicsCaptureSession m_session{ nullptr };
|
||||
wil::shared_event m_nextFrameEvent;
|
||||
wil::shared_event m_endEvent;
|
||||
wil::shared_event m_closedEvent;
|
||||
wil::srwlock m_lock;
|
||||
|
||||
winrt::Direct3D11CaptureFrame m_currentFrame{ nullptr };
|
||||
};
|
||||
1447
src/modules/ZoomIt/ZoomIt/DemoType.cpp
Normal file
1447
src/modules/ZoomIt/ZoomIt/DemoType.cpp
Normal file
File diff suppressed because it is too large
Load Diff
26
src/modules/ZoomIt/ZoomIt/DemoType.h
Normal file
26
src/modules/ZoomIt/ZoomIt/DemoType.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Copyright (C) Mark Russinovich
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// DemoType allows the presenter to synthesize keystrokes from a script
|
||||
//
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//============================================================================
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MAX_INPUT_SIZE 1048576 // 1 MiB
|
||||
|
||||
#define MAX_TYPING_SPEED 10 // ms
|
||||
#define MIN_TYPING_SPEED 100 // ms
|
||||
|
||||
#define ERROR_LOADING_FILE 1
|
||||
#define NO_FILE_SPECIFIED 2
|
||||
#define FILE_SIZE_OVERFLOW 3
|
||||
#define UNKNOWN_FILE_DATA 4
|
||||
|
||||
void ResetDemoTypeIndex();
|
||||
int StartDemoType( const TCHAR* filePath, const DWORD speedSlider, const BOOLEAN userDriven );
|
||||
3
src/modules/ZoomIt/ZoomIt/PowerToys/branding.h
Normal file
3
src/modules/ZoomIt/ZoomIt/PowerToys/branding.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define ZOOMIT_PRODUCT_NAME "PowerToys Sysinternals ZoomIt"
|
||||
324
src/modules/ZoomIt/ZoomIt/Registry.h
Normal file
324
src/modules/ZoomIt/ZoomIt/Registry.h
Normal file
@@ -0,0 +1,324 @@
|
||||
//============================================================================
|
||||
//
|
||||
// Process Explorer
|
||||
// Copyright (C) 1999-2005 Mark Russinovich
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Registry.h
|
||||
//
|
||||
//============================================================================
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
SETTING_TYPE_DWORD,
|
||||
SETTING_TYPE_BOOLEAN,
|
||||
SETTING_TYPE_DOUBLE,
|
||||
SETTING_TYPE_WORD,
|
||||
SETTING_TYPE_STRING,
|
||||
SETTING_TYPE_DWORD_ARRAY,
|
||||
SETTING_TYPE_WORD_ARRAY,
|
||||
SETTING_TYPE_BINARY
|
||||
} REG_SETTING_TYPE;
|
||||
|
||||
typedef struct {
|
||||
PCTSTR ValueName;
|
||||
REG_SETTING_TYPE Type;
|
||||
DWORD Size; // Optional
|
||||
PVOID Setting;
|
||||
double DefaultSetting;
|
||||
} REG_SETTING, *PREG_SETTING;
|
||||
|
||||
|
||||
class ClassRegistry {
|
||||
|
||||
private:
|
||||
PTCHAR m_KeyName;
|
||||
HKEY hKey;
|
||||
|
||||
public:
|
||||
ClassRegistry( PCTSTR KeyName )
|
||||
{
|
||||
m_KeyName = _tcsdup( KeyName );
|
||||
hKey = NULL;
|
||||
}
|
||||
|
||||
~ClassRegistry()
|
||||
{
|
||||
free( m_KeyName );
|
||||
}
|
||||
|
||||
void ReadRegSettings( PREG_SETTING Settings )
|
||||
{
|
||||
PREG_SETTING curSetting;
|
||||
|
||||
hKey = NULL;
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER,
|
||||
m_KeyName, 0, KEY_READ, &hKey );
|
||||
curSetting = Settings;
|
||||
while( curSetting->ValueName ) {
|
||||
|
||||
switch( curSetting->Type ) {
|
||||
case SETTING_TYPE_DWORD:
|
||||
ReadValue( curSetting->ValueName, static_cast<PDWORD>(curSetting->Setting),
|
||||
static_cast<DWORD>(curSetting->DefaultSetting));
|
||||
break;
|
||||
case SETTING_TYPE_BOOLEAN:
|
||||
ReadValue( curSetting->ValueName, static_cast<PBOOLEAN>(curSetting->Setting),
|
||||
static_cast<BOOLEAN>(curSetting->DefaultSetting));
|
||||
break;
|
||||
case SETTING_TYPE_DOUBLE:
|
||||
ReadValue( curSetting->ValueName, static_cast<double *>(curSetting->Setting),
|
||||
curSetting->DefaultSetting );
|
||||
break;
|
||||
case SETTING_TYPE_WORD:
|
||||
ReadValue( curSetting->ValueName, static_cast<short *>(curSetting->Setting),
|
||||
static_cast<WORD>(curSetting->DefaultSetting));
|
||||
break;
|
||||
case SETTING_TYPE_STRING:
|
||||
ReadValue( curSetting->ValueName, static_cast<PTCHAR>(curSetting->Setting),
|
||||
curSetting->Size, reinterpret_cast<PTCHAR>(static_cast<DWORD_PTR>(curSetting->DefaultSetting)));
|
||||
break;
|
||||
case SETTING_TYPE_DWORD_ARRAY:
|
||||
ReadValueArray( curSetting->ValueName, curSetting->Size/sizeof DWORD,
|
||||
static_cast<PWORD>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_WORD_ARRAY:
|
||||
ReadValueArray( curSetting->ValueName, curSetting->Size/sizeof(short),
|
||||
static_cast<PWORD>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_BINARY:
|
||||
ReadValueBinary( curSetting->ValueName, static_cast<PBYTE>(curSetting->Setting),
|
||||
curSetting->Size );
|
||||
break;
|
||||
}
|
||||
curSetting++;
|
||||
}
|
||||
if( hKey ) {
|
||||
|
||||
RegCloseKey( hKey );
|
||||
}
|
||||
}
|
||||
void WriteRegSettings( PREG_SETTING Settings )
|
||||
{
|
||||
PREG_SETTING curSetting;
|
||||
|
||||
if( !RegCreateKeyEx(HKEY_CURRENT_USER,
|
||||
m_KeyName, NULL, NULL, 0, KEY_WRITE, NULL, &hKey, NULL )) {
|
||||
|
||||
curSetting = Settings;
|
||||
while( curSetting->ValueName ) {
|
||||
|
||||
switch( curSetting->Type ) {
|
||||
case SETTING_TYPE_DWORD:
|
||||
WriteValue( curSetting->ValueName, *static_cast<PDWORD>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_BOOLEAN:
|
||||
WriteValue( curSetting->ValueName, *static_cast<PBOOLEAN>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_DOUBLE:
|
||||
WriteValue( curSetting->ValueName, *static_cast<double *>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_WORD:
|
||||
WriteValue( curSetting->ValueName, *static_cast<short *>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_STRING:
|
||||
WriteValue( curSetting->ValueName, static_cast<PTCHAR>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_DWORD_ARRAY:
|
||||
WriteValueArray( curSetting->ValueName, curSetting->Size/sizeof DWORD,
|
||||
static_cast<PDWORD>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_WORD_ARRAY:
|
||||
WriteValueArray( curSetting->ValueName, curSetting->Size/sizeof(short),
|
||||
static_cast<PWORD>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_BINARY:
|
||||
WriteValueBinary( curSetting->ValueName, static_cast<PBYTE>(curSetting->Setting),
|
||||
curSetting->Size );
|
||||
break;
|
||||
}
|
||||
curSetting++;
|
||||
}
|
||||
RegCloseKey( hKey );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Reads
|
||||
void ReadValue( PCTSTR ValueName, PDWORD Value, DWORD Default = 0 )
|
||||
{
|
||||
DWORD length = sizeof(DWORD);
|
||||
if( RegQueryValueEx( hKey, ValueName, NULL, NULL, reinterpret_cast<PBYTE>(Value),
|
||||
&length )) {
|
||||
|
||||
*Value = Default;
|
||||
}
|
||||
}
|
||||
void ReadValue( PCTSTR ValueName, PBOOLEAN Value, BOOLEAN Default = FALSE )
|
||||
{
|
||||
DWORD length = sizeof(DWORD);
|
||||
DWORD val = static_cast<DWORD>(*Value);
|
||||
if( RegQueryValueEx( hKey, ValueName, NULL, NULL, reinterpret_cast<PBYTE>(&val),
|
||||
&length )) {
|
||||
|
||||
*Value = Default;
|
||||
|
||||
} else {
|
||||
|
||||
*Value = static_cast<BOOLEAN>(val);
|
||||
}
|
||||
}
|
||||
void ReadValue( PCTSTR ValueName, short *Value, short Default = 0 )
|
||||
{
|
||||
DWORD length = sizeof(DWORD);
|
||||
DWORD val = static_cast<DWORD>(*Value);
|
||||
if( RegQueryValueEx( hKey, ValueName, NULL, NULL, reinterpret_cast<PBYTE>(&val),
|
||||
&length )) {
|
||||
|
||||
*Value = Default;
|
||||
|
||||
} else {
|
||||
|
||||
*Value = static_cast<short>(val);
|
||||
}
|
||||
}
|
||||
void ReadValue( PCTSTR ValueName, double *Value, double Default = 0.0 )
|
||||
{
|
||||
DWORD length = sizeof(double);
|
||||
if( RegQueryValueEx( hKey, ValueName, NULL, NULL, reinterpret_cast<PBYTE>(Value),
|
||||
&length )) {
|
||||
|
||||
*Value = Default;
|
||||
|
||||
}
|
||||
}
|
||||
void ReadValue( PCTSTR ValueName, PTCHAR Value, DWORD Length, PCTSTR Default )
|
||||
{
|
||||
if( RegQueryValueEx( hKey, ValueName, NULL, NULL, reinterpret_cast<PBYTE>(Value),
|
||||
&Length ) && Default ) {
|
||||
|
||||
_tcscpy_s( Value, Length, Default );
|
||||
}
|
||||
}
|
||||
void ReadValueBinary( PCTSTR ValueName, PBYTE Value, DWORD Length )
|
||||
{
|
||||
RegQueryValueEx( hKey, ValueName, NULL, NULL, Value,
|
||||
&Length );
|
||||
}
|
||||
void ReadValueArray( PCTSTR ValueName, DWORD Number, PDWORD Entries )
|
||||
{
|
||||
HKEY hSubKey;
|
||||
TCHAR subVal[16];
|
||||
DWORD length;
|
||||
|
||||
if( !RegOpenKeyEx(hKey,
|
||||
ValueName, 0, KEY_READ, &hSubKey )) {
|
||||
|
||||
for( DWORD i = 0; i < Number; i++ ) {
|
||||
|
||||
length = sizeof(DWORD);
|
||||
_stprintf_s( subVal, _countof(subVal), _T("%d"), i );
|
||||
RegQueryValueEx( hSubKey, subVal, NULL, NULL, reinterpret_cast<PBYTE>(&Entries[i]), &length);
|
||||
}
|
||||
RegCloseKey( hSubKey );
|
||||
}
|
||||
}
|
||||
void ReadValueArray( PCTSTR ValueName, DWORD Number, PWORD Entries )
|
||||
{
|
||||
HKEY hSubKey;
|
||||
TCHAR subVal[16];
|
||||
DWORD length;
|
||||
DWORD val;
|
||||
|
||||
if( !RegOpenKeyEx(hKey,
|
||||
ValueName, 0, KEY_READ, &hSubKey )) {
|
||||
|
||||
for( DWORD i = 0; i < Number; i++ ) {
|
||||
|
||||
length = sizeof(DWORD);
|
||||
_stprintf_s( subVal, _countof(subVal), _T("%d"), i );
|
||||
if( !RegQueryValueEx( hSubKey, subVal, NULL, NULL, reinterpret_cast<PBYTE>(&val), &length)) {
|
||||
|
||||
Entries[i] = static_cast<WORD>(val);
|
||||
|
||||
}
|
||||
}
|
||||
RegCloseKey( hSubKey );
|
||||
}
|
||||
}
|
||||
|
||||
// Writes
|
||||
void WriteValue( PCTSTR ValueName, DWORD Value )
|
||||
{
|
||||
RegSetValueEx( hKey, ValueName, 0, REG_DWORD, reinterpret_cast<PBYTE>(&Value),
|
||||
sizeof(DWORD));
|
||||
}
|
||||
void WriteValue( PCTSTR ValueName, short Value )
|
||||
{
|
||||
DWORD val = static_cast<DWORD>(Value);
|
||||
RegSetValueEx( hKey, ValueName, 0, REG_DWORD, reinterpret_cast<PBYTE>(&val),
|
||||
sizeof(DWORD));
|
||||
}
|
||||
void WriteValue( PCTSTR ValueName, BOOLEAN Value )
|
||||
{
|
||||
DWORD val = static_cast<DWORD>(Value);
|
||||
RegSetValueEx( hKey, ValueName, 0, REG_DWORD, reinterpret_cast<PBYTE>(&val),
|
||||
sizeof(DWORD));
|
||||
}
|
||||
void WriteValue( PCTSTR ValueName, double Value )
|
||||
{
|
||||
RegSetValueEx( hKey, ValueName, 0, REG_BINARY, reinterpret_cast<PBYTE>(&Value),
|
||||
sizeof(double));
|
||||
}
|
||||
void WriteValue( PCTSTR ValueName, PTCHAR Value )
|
||||
{
|
||||
RegSetValueEx( hKey, ValueName, 0, REG_SZ, reinterpret_cast<PBYTE>(Value),
|
||||
static_cast<DWORD>(_tcslen( Value )) * sizeof(TCHAR));
|
||||
}
|
||||
void WriteValueBinary( PCTSTR ValueName, PBYTE Value, DWORD Length )
|
||||
{
|
||||
RegSetValueEx( hKey, ValueName, 0, REG_BINARY, Value,
|
||||
Length );
|
||||
}
|
||||
void WriteValueArray( PCTSTR ValueName, DWORD Number, PDWORD Entries )
|
||||
{
|
||||
HKEY hSubKey;
|
||||
TCHAR subVal[16];
|
||||
|
||||
if( !RegCreateKeyEx(hKey,
|
||||
ValueName, NULL, NULL, 0, KEY_WRITE, NULL, &hSubKey, NULL )) {
|
||||
|
||||
for( DWORD i = 0; i < Number; i++ ) {
|
||||
|
||||
_stprintf_s( subVal, _countof(subVal), _T("%d"), i );
|
||||
if( Entries[i] )
|
||||
RegSetValueEx( hSubKey, subVal, 0, REG_DWORD, reinterpret_cast<PBYTE>(&Entries[i]), sizeof(DWORD));
|
||||
else
|
||||
RegDeleteValue( hSubKey, subVal );
|
||||
}
|
||||
RegCloseKey( hSubKey );
|
||||
}
|
||||
}
|
||||
void WriteValueArray( PCTSTR ValueName, DWORD Number, PWORD Entries )
|
||||
{
|
||||
HKEY hSubKey;
|
||||
TCHAR subVal[16];
|
||||
DWORD val;
|
||||
|
||||
if( !RegCreateKeyEx(hKey,
|
||||
ValueName, NULL, NULL, 0, KEY_WRITE, NULL, &hSubKey, NULL )) {
|
||||
|
||||
for( DWORD i = 0; i < Number; i++ ) {
|
||||
|
||||
_stprintf_s( subVal, _countof(subVal), _T("%d"), i );
|
||||
val = static_cast<DWORD>(Entries[i]);
|
||||
if( Entries[i] )
|
||||
RegSetValueEx( hSubKey, subVal, 0, REG_DWORD, reinterpret_cast<PBYTE>(&val), sizeof(DWORD));
|
||||
else
|
||||
RegDeleteValue( hSubKey, subVal );
|
||||
}
|
||||
RegCloseKey( hSubKey );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
269
src/modules/ZoomIt/ZoomIt/SelectRectangle.cpp
Normal file
269
src/modules/ZoomIt/ZoomIt/SelectRectangle.cpp
Normal file
@@ -0,0 +1,269 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Class to select a recording rectangle and show it while recording
|
||||
//
|
||||
//==============================================================================
|
||||
#include "pch.h"
|
||||
#include "SelectRectangle.h"
|
||||
#include "Utility.h"
|
||||
#include "WindowsVersions.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// SelectRectangle::Start
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
bool SelectRectangle::Start( HWND ownerWindow, bool fullMonitor )
|
||||
{
|
||||
WNDCLASSW windowClass{};
|
||||
windowClass.lpfnWndProc = []( HWND window, UINT message, WPARAM wordParam, LPARAM longParam ) -> LRESULT
|
||||
{
|
||||
if( message == WM_NCCREATE )
|
||||
{
|
||||
auto createStruct = reinterpret_cast<LPCREATESTRUCT>(longParam);
|
||||
SetWindowLongPtrW( window, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(createStruct->lpCreateParams) );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
auto self = reinterpret_cast<SelectRectangle*>(GetWindowLongPtrW( window, GWLP_USERDATA ));
|
||||
return self->WindowProc( window, message, wordParam, longParam );
|
||||
};
|
||||
windowClass.hInstance = GetModuleHandle( nullptr );
|
||||
windowClass.hCursor = LoadCursorW( nullptr, IDC_CROSS );
|
||||
windowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject( BLACK_BRUSH ));
|
||||
windowClass.lpszClassName = m_className;
|
||||
if( RegisterClassW( &windowClass ) == 0 )
|
||||
{
|
||||
THROW_LAST_ERROR_IF( GetLastError() != ERROR_CLASS_ALREADY_EXISTS );
|
||||
|
||||
WNDCLASSW existingClass{};
|
||||
THROW_IF_WIN32_BOOL_FALSE( GetClassInfoW( GetModuleHandle( nullptr ), m_className, &existingClass ) );
|
||||
THROW_LAST_ERROR_IF( existingClass.lpfnWndProc != windowClass.lpfnWndProc );
|
||||
}
|
||||
|
||||
m_cancel = false;
|
||||
auto rect = GetMonitorRectFromCursor();
|
||||
m_window = wil::unique_hwnd( CreateWindowExW( WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_TOPMOST, m_className, nullptr, WS_POPUP,
|
||||
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, ownerWindow,
|
||||
nullptr, nullptr, this ) );
|
||||
THROW_LAST_ERROR_IF_NULL( m_window.get() );
|
||||
|
||||
if( fullMonitor )
|
||||
{
|
||||
m_selectedRect = rect;
|
||||
ShowSelected();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLayeredWindowAttributes( m_window.get(), 0, Alpha(), LWA_ALPHA );
|
||||
}
|
||||
|
||||
ShowWindow( m_window.get(), SW_SHOW );
|
||||
SetForegroundWindow( m_window.get() );
|
||||
|
||||
if( !fullMonitor )
|
||||
{
|
||||
GetClipCursor( &m_oldClipRect );
|
||||
ClipCursor( &rect );
|
||||
m_setClip = true;
|
||||
}
|
||||
|
||||
MSG message;
|
||||
while( GetMessageW( &message, nullptr, 0, 0 ) != 0 )
|
||||
{
|
||||
TranslateMessage( &message );
|
||||
DispatchMessageW( &message );
|
||||
if( m_cancel )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( m_selected )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// SelectRectangle::Stop
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void SelectRectangle::Stop()
|
||||
{
|
||||
if( m_setClip )
|
||||
{
|
||||
ClipCursor( &m_oldClipRect );
|
||||
m_setClip = false;
|
||||
}
|
||||
m_window.reset();
|
||||
m_selected = false;
|
||||
m_selectedRect = {};
|
||||
m_cancel = true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// SelectRectangle::ShowSelected
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void SelectRectangle::ShowSelected()
|
||||
{
|
||||
m_selected = true;
|
||||
|
||||
// Set the alpha to match the Windows graphics capture API yellow border
|
||||
// and set the window to be transparent and disabled, so it will be skipped
|
||||
// for hit testing and as a candidate for the next foreground window.
|
||||
SetLayeredWindowAttributes( m_window.get(), 0, 191, LWA_ALPHA );
|
||||
SetWindowLong( m_window.get(), GWL_EXSTYLE, GetWindowLong( m_window.get(), GWL_EXSTYLE ) | WS_EX_TRANSPARENT );
|
||||
EnableWindow( m_window.get(), FALSE );
|
||||
|
||||
POINT point{ m_selectedRect.left, m_selectedRect.top };
|
||||
auto rect = m_selectedRect;
|
||||
OffsetRect( &rect, -rect.left, -rect.top );
|
||||
int width = ScaleForDpi( 2, m_dpi );
|
||||
|
||||
// Draw the selection border outside the selected rectangle on builds lower
|
||||
// than Windows 11 22H2 because the graphics capture API does not skip
|
||||
// windows if layered, meaning this yellow border will be captured.
|
||||
if( GetWindowsBuild( nullptr ) < BUILD_WINDOWS_11_22H2 )
|
||||
{
|
||||
InflateRect( &rect, width, width );
|
||||
OffsetRect( &rect, -rect.left, -rect.top );
|
||||
point.x -= width;
|
||||
point.y -= width;
|
||||
}
|
||||
|
||||
// Resize the window to the selection rectangle and translate the position.
|
||||
RECT windowRect;
|
||||
GetWindowRect( m_window.get(), &windowRect );
|
||||
point.x += windowRect.left;
|
||||
point.y += windowRect.top;
|
||||
MoveWindow( m_window.get(), point.x, point.y, rect.right, rect.bottom, true );
|
||||
|
||||
// Use a region to keep everything but the border transparent.
|
||||
wil::unique_hrgn region{CreateRectRgnIndirect( &rect )};
|
||||
InflateRect( &rect, -width, -width );
|
||||
wil::unique_hrgn insideRegion{CreateRectRgnIndirect( &rect )};
|
||||
CombineRgn( region.get(), region.get(), insideRegion.get(), RGN_XOR );
|
||||
SetWindowRgn( m_window.get(), region.release(), true );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// SelectRectangle::UpdateOwner
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void SelectRectangle::UpdateOwner( HWND window )
|
||||
{
|
||||
if( m_window != nullptr )
|
||||
{
|
||||
SetWindowLongPtr( m_window.get(), GWLP_HWNDPARENT, reinterpret_cast<LONG_PTR>(window) );
|
||||
SetWindowPos( m_window.get(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE );
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// SelectRectangle::WindowProc
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
LRESULT SelectRectangle::WindowProc( HWND window, UINT message, WPARAM wordParam, LPARAM longParam )
|
||||
{
|
||||
switch( message )
|
||||
{
|
||||
case WM_CREATE:
|
||||
m_dpi = GetDpiForWindowHelper( window );
|
||||
SetWindowDisplayAffinity( window, WDA_EXCLUDEFROMCAPTURE );
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
Stop();
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
SetCapture( window );
|
||||
|
||||
m_startPoint = { GET_X_LPARAM( longParam ), GET_Y_LPARAM( longParam ) };
|
||||
[[fallthrough]];
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
if( GetCapture() == window )
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect( window, &rect );
|
||||
POINT point{ GET_X_LPARAM( longParam ), GET_Y_LPARAM( longParam ) };
|
||||
m_selectedRect = ForceRectInBounds( RectFromPointsMinSize( m_startPoint, point, MinSize() ), rect );
|
||||
|
||||
// Use a region to carve out the selected rectangle.
|
||||
wil::unique_hrgn region{CreateRectRgnIndirect( &m_selectedRect )};
|
||||
wil::unique_hrgn clientRegion{CreateRectRgnIndirect( &rect )};
|
||||
CombineRgn( region.get(), region.get(), clientRegion.get(), RGN_XOR );
|
||||
SetWindowRgn( window, region.release(), true );
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if( wordParam == VK_ESCAPE )
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
if( !m_selected )
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
if( m_setClip )
|
||||
{
|
||||
ClipCursor( &m_oldClipRect );
|
||||
m_setClip = false;
|
||||
}
|
||||
ReleaseCapture();
|
||||
|
||||
ShowSelected();
|
||||
return 0;
|
||||
}
|
||||
case WM_NCHITTEST:
|
||||
if( m_selected )
|
||||
{
|
||||
return HTTRANSPARENT;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
if( m_selected )
|
||||
{
|
||||
PAINTSTRUCT paint;
|
||||
auto deviceContext = BeginPaint( window, &paint );
|
||||
|
||||
RECT rect;
|
||||
GetClientRect( window, &rect );
|
||||
|
||||
// Draw a border matching the Windows graphics capture API border.
|
||||
// The outer frame is yellow and two logical pixels wide, while the
|
||||
// inner is black and 1 logical pixel wide.
|
||||
wil::unique_hbrush brush{CreateSolidBrush( RGB( 255, 222, 0 ) )};
|
||||
FillRect( deviceContext, &rect, brush.get() );
|
||||
int width = ScaleForDpi( 1, m_dpi );
|
||||
InflateRect( &rect, -width, -width );
|
||||
FillRect( deviceContext, &rect, static_cast<HBRUSH>(GetStockObject( BLACK_BRUSH )) );
|
||||
|
||||
EndPaint( window, &paint );
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProcW( window, message, wordParam, longParam );
|
||||
}
|
||||
44
src/modules/ZoomIt/ZoomIt/SelectRectangle.h
Normal file
44
src/modules/ZoomIt/ZoomIt/SelectRectangle.h
Normal file
@@ -0,0 +1,44 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Class to select a recording rectangle and show it while recording
|
||||
//
|
||||
//==============================================================================
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
class SelectRectangle
|
||||
{
|
||||
public:
|
||||
~SelectRectangle() { Stop(); };
|
||||
|
||||
void Alpha( BYTE alpha ) { m_alpha = alpha; }
|
||||
BYTE Alpha() const { return m_alpha; }
|
||||
void MinSize( int minSize ) { m_minSize = minSize; }
|
||||
int MinSize() const { return m_minSize; }
|
||||
RECT SelectedRect() const { return m_selectedRect; }
|
||||
|
||||
bool Start( HWND ownerWindow = nullptr, bool fullMonitor = false );
|
||||
void Stop();
|
||||
void UpdateOwner( HWND window );
|
||||
|
||||
private:
|
||||
BYTE m_alpha = 176;
|
||||
int m_minSize = 34;
|
||||
RECT m_selectedRect{};
|
||||
|
||||
bool m_cancel = false;
|
||||
const wchar_t* m_className = L"ZoomitSelectRectangle";
|
||||
UINT m_dpi{};
|
||||
RECT m_oldClipRect{};
|
||||
bool m_selected{ false };
|
||||
bool m_setClip{ false };
|
||||
POINT m_startPoint{};
|
||||
wil::unique_hwnd m_window;
|
||||
|
||||
void ShowSelected();
|
||||
LRESULT WindowProc( HWND window, UINT message, WPARAM wordParam, LPARAM longParam );
|
||||
};
|
||||
153
src/modules/ZoomIt/ZoomIt/Utility.cpp
Normal file
153
src/modules/ZoomIt/ZoomIt/Utility.cpp
Normal file
@@ -0,0 +1,153 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
//==============================================================================
|
||||
#include "pch.h"
|
||||
#include "Utility.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// ForceRectInBounds
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
RECT ForceRectInBounds( RECT rect, const RECT& bounds )
|
||||
{
|
||||
if( rect.left < bounds.left )
|
||||
{
|
||||
rect.right += bounds.left - rect.left;
|
||||
rect.left = bounds.left;
|
||||
}
|
||||
if( rect.top < bounds.top )
|
||||
{
|
||||
rect.bottom += bounds.top - rect.top;
|
||||
rect.top = bounds.top;
|
||||
}
|
||||
if( rect.right > bounds.right )
|
||||
{
|
||||
rect.left -= rect.right - bounds.right;
|
||||
rect.right = bounds.right;
|
||||
}
|
||||
if( rect.bottom > bounds.bottom )
|
||||
{
|
||||
rect.top -= rect.bottom - bounds.bottom;
|
||||
rect.bottom = bounds.bottom;
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// GetDpiForWindow
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
UINT GetDpiForWindowHelper( HWND window )
|
||||
{
|
||||
auto function = reinterpret_cast<UINT (WINAPI *)(HWND)>(GetProcAddress( GetModuleHandleW( L"user32.dll" ), "GetDpiForWindow" ));
|
||||
if( function )
|
||||
{
|
||||
return function( window );
|
||||
}
|
||||
|
||||
wil::unique_hdc hdc{GetDC( nullptr )};
|
||||
return static_cast<UINT>(GetDeviceCaps( hdc.get(), LOGPIXELSX ));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// GetMonitorRectFromCursor
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
RECT GetMonitorRectFromCursor()
|
||||
{
|
||||
POINT point;
|
||||
GetCursorPos( &point );
|
||||
MONITORINFO monitorInfo{};
|
||||
monitorInfo.cbSize = sizeof( monitorInfo );
|
||||
GetMonitorInfoW( MonitorFromPoint( point, MONITOR_DEFAULTTONEAREST ), &monitorInfo );
|
||||
return monitorInfo.rcMonitor;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// RectFromPointsMinSize
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
#ifdef _MSC_VER
|
||||
// avoid making RectFromPointsMinSize constexpr since that leads to link errors
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 26497)
|
||||
#endif
|
||||
|
||||
RECT RectFromPointsMinSize( POINT a, POINT b, LONG minSize )
|
||||
{
|
||||
RECT rect;
|
||||
if( a.x <= b.x )
|
||||
{
|
||||
rect.left = a.x;
|
||||
rect.right = b.x + 1;
|
||||
if( (rect.right - rect.left) < minSize )
|
||||
{
|
||||
rect.right = rect.left + minSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.left = b.x;
|
||||
rect.right = a.x + 1;
|
||||
if( (rect.right - rect.left) < minSize )
|
||||
{
|
||||
rect.left = rect.right - minSize;
|
||||
}
|
||||
}
|
||||
if( a.y <= b.y )
|
||||
{
|
||||
rect.top = a.y;
|
||||
rect.bottom = b.y + 1;
|
||||
if( (rect.bottom - rect.top) < minSize )
|
||||
{
|
||||
rect.bottom = rect.top + minSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.top = b.y;
|
||||
rect.bottom = a.y + 1;
|
||||
if( (rect.bottom - rect.top) < minSize )
|
||||
{
|
||||
rect.top = rect.bottom - minSize;
|
||||
}
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// ScaleForDpi
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
int ScaleForDpi( int value, UINT dpi )
|
||||
{
|
||||
return MulDiv( value, static_cast<int>(dpi), USER_DEFAULT_SCREEN_DPI );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// ScalePointInRects
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
POINT ScalePointInRects( POINT point, const RECT& source, const RECT& target )
|
||||
{
|
||||
const SIZE sourceSize{ source.right - source.left, source.bottom - source.top };
|
||||
const POINT sourceCenter{ source.left + sourceSize.cx / 2, source.top + sourceSize.cy / 2 };
|
||||
const SIZE targetSize{ target.right - target.left, target.bottom - target.top };
|
||||
const POINT targetCenter{ target.left + targetSize.cx / 2, target.top + targetSize.cy / 2 };
|
||||
|
||||
return { targetCenter.x + MulDiv( point.x - sourceCenter.x, targetSize.cx, sourceSize.cx ),
|
||||
targetCenter.y + MulDiv( point.y - sourceCenter.y, targetSize.cy, sourceSize.cy ) };
|
||||
}
|
||||
18
src/modules/ZoomIt/ZoomIt/Utility.h
Normal file
18
src/modules/ZoomIt/ZoomIt/Utility.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
//==============================================================================
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
RECT ForceRectInBounds( RECT rect, const RECT& bounds );
|
||||
UINT GetDpiForWindowHelper( HWND window );
|
||||
RECT GetMonitorRectFromCursor();
|
||||
RECT RectFromPointsMinSize( POINT a, POINT b, LONG minSize );
|
||||
int ScaleForDpi( int value, UINT dpi );
|
||||
POINT ScalePointInRects( POINT point, const RECT& source, const RECT& target );
|
||||
129
src/modules/ZoomIt/ZoomIt/VersionHelper.cpp
Normal file
129
src/modules/ZoomIt/ZoomIt/VersionHelper.cpp
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
// GetLanguageVersionString
|
||||
//
|
||||
// Gets version information for a particular code page.
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include "pch.h"
|
||||
#include "VersionHelper.h"
|
||||
|
||||
PTCHAR GetLanguageVersionString(P_VERSION_INFO VersionInfo,
|
||||
LANGID LanguageId, WORD Charset,
|
||||
LPCTSTR VersionString)
|
||||
{
|
||||
TCHAR szQueryStr[0x100];
|
||||
PTCHAR pszVerRetVal;
|
||||
UINT cbReturn;
|
||||
BOOL fFound = FALSE;
|
||||
|
||||
// Format the string
|
||||
_stprintf_s(szQueryStr, ARRAYSIZE(szQueryStr), _T("\\StringFileInfo\\%04X%04X\\%s"),
|
||||
LanguageId, Charset,
|
||||
VersionString);
|
||||
|
||||
fFound = VerQueryValue(VersionInfo, szQueryStr,
|
||||
reinterpret_cast<LPVOID *>(&pszVerRetVal), &cbReturn);
|
||||
|
||||
if (!fFound) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return pszVerRetVal;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// explicitly use wide char version
|
||||
// this is used when show banner in remote session before display eula from console which requires unicode for French
|
||||
// it's needed for multibyte app
|
||||
//
|
||||
PWCHAR GetLanguageVersionStringW(P_VERSION_INFO VersionInfo,
|
||||
LANGID LanguageId, WORD Charset,
|
||||
LPCWSTR VersionString)
|
||||
{
|
||||
WCHAR szQueryStr[0x100];
|
||||
PWCHAR pszVerRetVal;
|
||||
UINT cbReturn;
|
||||
BOOL fFound = FALSE;
|
||||
|
||||
// Format the string
|
||||
swprintf_s(szQueryStr, ARRAYSIZE(szQueryStr), L"\\StringFileInfo\\%04X%04X\\%s",
|
||||
LanguageId, Charset,
|
||||
VersionString);
|
||||
|
||||
fFound = VerQueryValueW(VersionInfo, szQueryStr,
|
||||
reinterpret_cast<LPVOID *>(&pszVerRetVal), &cbReturn);
|
||||
|
||||
if (!fFound) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return pszVerRetVal;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
// GetVersionString
|
||||
//
|
||||
// Gets a version string.
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
PTCHAR GetVersionString(P_VERSION_INFO VersionInfo,
|
||||
LPCTSTR VersionString)
|
||||
{
|
||||
PTCHAR pszVerRetVal;
|
||||
P_VERSION_TRANSLATION pTranslation;
|
||||
VERSION_TRANSLATION translation;
|
||||
unsigned int length;
|
||||
|
||||
//
|
||||
// Get the language id
|
||||
//
|
||||
translation.langID = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
||||
pTranslation = &translation;
|
||||
VerQueryValue(VersionInfo,
|
||||
_T("\\VarFileInfo\\Translation"),
|
||||
reinterpret_cast<PVOID *>(&pTranslation),
|
||||
&length);
|
||||
|
||||
pszVerRetVal = GetLanguageVersionString(VersionInfo,
|
||||
pTranslation->langID,
|
||||
pTranslation->charset,
|
||||
VersionString);
|
||||
return pszVerRetVal;
|
||||
}
|
||||
|
||||
//
|
||||
// explicitly use wide char version
|
||||
// this is used when show banner in remote session before display eula from console which requires unicode for French
|
||||
// it's needed for multibyte app
|
||||
//
|
||||
PWCHAR GetVersionStringW(P_VERSION_INFO VersionInfo,
|
||||
LPCWSTR VersionString)
|
||||
{
|
||||
PWCHAR pszVerRetVal;
|
||||
P_VERSION_TRANSLATION pTranslation;
|
||||
VERSION_TRANSLATION translation;
|
||||
unsigned int length;
|
||||
|
||||
//
|
||||
// Get the language id
|
||||
//
|
||||
translation.langID = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
||||
pTranslation = &translation;
|
||||
VerQueryValueW(VersionInfo,
|
||||
L"\\VarFileInfo\\Translation",
|
||||
reinterpret_cast<PVOID *>(&pTranslation),
|
||||
&length);
|
||||
|
||||
pszVerRetVal = GetLanguageVersionStringW(VersionInfo,
|
||||
pTranslation->langID,
|
||||
pTranslation->charset,
|
||||
VersionString);
|
||||
return pszVerRetVal;
|
||||
}
|
||||
48
src/modules/ZoomIt/ZoomIt/VersionHelper.h
Normal file
48
src/modules/ZoomIt/ZoomIt/VersionHelper.h
Normal file
@@ -0,0 +1,48 @@
|
||||
//============================================================================
|
||||
//
|
||||
// VersionHelper.h
|
||||
//
|
||||
// Functions to retrieve version information
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include "winver.h"
|
||||
|
||||
//
|
||||
// File version information
|
||||
//
|
||||
typedef struct {
|
||||
WORD wLength;
|
||||
WORD wValueLength;
|
||||
WORD wType;
|
||||
WCHAR szKey[16];
|
||||
WORD Padding1;
|
||||
VS_FIXEDFILEINFO Value;
|
||||
} VERSION_INFO, *P_VERSION_INFO;
|
||||
|
||||
//
|
||||
// Version translation
|
||||
//
|
||||
typedef struct {
|
||||
WORD langID; // language ID
|
||||
WORD charset; // character set (code page)
|
||||
} VERSION_TRANSLATION, *P_VERSION_TRANSLATION;
|
||||
|
||||
PTCHAR GetVersionString(P_VERSION_INFO VersionInfo, LPCTSTR VersionString);
|
||||
|
||||
PTCHAR GetLanguageVersionString(P_VERSION_INFO VersionInfo,
|
||||
LANGID LanguageId,
|
||||
WORD Charset,
|
||||
LPCTSTR VersionString);
|
||||
|
||||
PWCHAR GetLanguageVersionStringW(P_VERSION_INFO VersionInfo,
|
||||
LANGID LanguageId, WORD Charset,
|
||||
LPCWSTR VersionString);
|
||||
|
||||
PWCHAR GetVersionStringW(P_VERSION_INFO VersionInfo,
|
||||
LPCWSTR VersionString);
|
||||
|
||||
391
src/modules/ZoomIt/ZoomIt/VideoRecordingSession.cpp
Normal file
391
src/modules/ZoomIt/ZoomIt/VideoRecordingSession.cpp
Normal file
@@ -0,0 +1,391 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Video capture code derived from https://github.com/robmikh/capturevideosample
|
||||
//
|
||||
//==============================================================================
|
||||
#include "pch.h"
|
||||
#include "VideoRecordingSession.h"
|
||||
#include "CaptureFrameWait.h"
|
||||
|
||||
extern DWORD g_RecordScaling;
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Graphics;
|
||||
using namespace Windows::Graphics::Capture;
|
||||
using namespace Windows::Graphics::DirectX;
|
||||
using namespace Windows::Graphics::DirectX::Direct3D11;
|
||||
using namespace Windows::Storage;
|
||||
using namespace Windows::UI::Composition;
|
||||
using namespace Windows::Media::Core;
|
||||
using namespace Windows::Media::Transcoding;
|
||||
using namespace Windows::Media::MediaProperties;
|
||||
}
|
||||
|
||||
namespace util
|
||||
{
|
||||
using namespace robmikh::common::uwp;
|
||||
}
|
||||
|
||||
const float CLEAR_COLOR[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
int32_t EnsureEven(int32_t value)
|
||||
{
|
||||
if (value % 2 == 0)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return value + 1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::VideoRecordingSession
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
VideoRecordingSession::VideoRecordingSession(
|
||||
winrt::IDirect3DDevice const& device,
|
||||
winrt::GraphicsCaptureItem const& item,
|
||||
RECT const cropRect,
|
||||
uint32_t frameRate,
|
||||
bool captureAudio,
|
||||
winrt::Streams::IRandomAccessStream const& stream)
|
||||
{
|
||||
m_device = device;
|
||||
m_d3dDevice = GetDXGIInterfaceFromObject<ID3D11Device>(m_device);
|
||||
m_d3dDevice->GetImmediateContext(m_d3dContext.put());
|
||||
m_item = item;
|
||||
auto itemSize = item.Size();
|
||||
auto inputWidth = EnsureEven(itemSize.Width);
|
||||
auto inputHeight = EnsureEven(itemSize.Height);
|
||||
m_frameWait = std::make_shared<CaptureFrameWait>(m_device, m_item, winrt::SizeInt32{ inputWidth, inputHeight });
|
||||
auto weakPointer{ std::weak_ptr{ m_frameWait } };
|
||||
m_itemClosed = item.Closed(winrt::auto_revoke, [weakPointer](auto&, auto&)
|
||||
{
|
||||
auto sharedPointer{ weakPointer.lock() };
|
||||
|
||||
if (sharedPointer)
|
||||
{
|
||||
sharedPointer->StopCapture();
|
||||
}
|
||||
});
|
||||
|
||||
// Get crop dimension
|
||||
if( (cropRect.right - cropRect.left) != 0 )
|
||||
{
|
||||
m_rcCrop = cropRect;
|
||||
m_frameWait->ShowCaptureBorder( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rcCrop.left = 0;
|
||||
m_rcCrop.top = 0;
|
||||
m_rcCrop.right = inputWidth;
|
||||
m_rcCrop.bottom = inputHeight;
|
||||
}
|
||||
|
||||
// Ensure the video is not too small and try to maintain the aspect ratio
|
||||
constexpr int c_minimumSize = 34;
|
||||
auto scaledWidth = MulDiv(m_rcCrop.right - m_rcCrop.left, g_RecordScaling, 100);
|
||||
auto scaledHeight = MulDiv(m_rcCrop.bottom - m_rcCrop.top, g_RecordScaling, 100);
|
||||
auto outputWidth = scaledWidth;
|
||||
auto outputHeight = scaledHeight;
|
||||
if (outputWidth < c_minimumSize)
|
||||
{
|
||||
outputWidth = c_minimumSize;
|
||||
outputHeight = MulDiv(outputHeight, outputWidth, scaledWidth);
|
||||
}
|
||||
if (outputHeight < c_minimumSize)
|
||||
{
|
||||
outputHeight = c_minimumSize;
|
||||
outputWidth = MulDiv(outputWidth, outputHeight, scaledHeight);
|
||||
}
|
||||
if (outputWidth > inputWidth)
|
||||
{
|
||||
outputWidth = inputWidth;
|
||||
outputHeight = c_minimumSize, MulDiv(outputHeight, scaledWidth, outputWidth);
|
||||
}
|
||||
if (outputHeight > inputHeight)
|
||||
{
|
||||
outputHeight = inputHeight;
|
||||
outputWidth = c_minimumSize, MulDiv(outputWidth, scaledHeight, outputHeight);
|
||||
}
|
||||
outputWidth = EnsureEven(outputWidth);
|
||||
outputHeight = EnsureEven(outputHeight);
|
||||
|
||||
// Describe out output: H264 video with an MP4 container
|
||||
m_encodingProfile = winrt::MediaEncodingProfile();
|
||||
m_encodingProfile.Container().Subtype(L"MPEG4");
|
||||
auto video = m_encodingProfile.Video();
|
||||
video.Subtype(L"H264");
|
||||
video.Width(outputWidth);
|
||||
video.Height(outputHeight);
|
||||
video.Bitrate(static_cast<uint32_t>(outputWidth * outputHeight * frameRate * 2 * 0.07));
|
||||
video.FrameRate().Numerator(frameRate);
|
||||
video.FrameRate().Denominator(1);
|
||||
video.PixelAspectRatio().Numerator(1);
|
||||
video.PixelAspectRatio().Denominator(1);
|
||||
m_encodingProfile.Video(video);
|
||||
|
||||
// if audio capture, set up audio profile
|
||||
if (captureAudio)
|
||||
{
|
||||
auto audio = m_encodingProfile.Audio();
|
||||
audio = winrt::AudioEncodingProperties::CreateAac(48000, 1, 16);
|
||||
m_encodingProfile.Audio(audio);
|
||||
}
|
||||
|
||||
// Describe our input: uncompressed BGRA8 buffers
|
||||
auto properties = winrt::VideoEncodingProperties::CreateUncompressed(
|
||||
winrt::MediaEncodingSubtypes::Bgra8(),
|
||||
static_cast<uint32_t>(m_rcCrop.right - m_rcCrop.left),
|
||||
static_cast<uint32_t>(m_rcCrop.bottom - m_rcCrop.top));
|
||||
m_videoDescriptor = winrt::VideoStreamDescriptor(properties);
|
||||
|
||||
m_stream = stream;
|
||||
|
||||
m_previewSwapChain = util::CreateDXGISwapChain(
|
||||
m_d3dDevice,
|
||||
static_cast<uint32_t>(m_rcCrop.right - m_rcCrop.left),
|
||||
static_cast<uint32_t>(m_rcCrop.bottom - m_rcCrop.top),
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
2);
|
||||
winrt::com_ptr<ID3D11Texture2D> backBuffer;
|
||||
winrt::check_hresult(m_previewSwapChain->GetBuffer(0, winrt::guid_of<ID3D11Texture2D>(), backBuffer.put_void()));
|
||||
winrt::check_hresult(m_d3dDevice->CreateRenderTargetView(backBuffer.get(), nullptr, m_renderTargetView.put()));
|
||||
|
||||
if( captureAudio ) {
|
||||
|
||||
m_audioGenerator = std::make_unique<AudioSampleGenerator>();
|
||||
}
|
||||
else {
|
||||
|
||||
m_audioGenerator = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::~VideoRecordingSession
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
VideoRecordingSession::~VideoRecordingSession()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::StartAsync
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
winrt::IAsyncAction VideoRecordingSession::StartAsync()
|
||||
{
|
||||
auto expected = false;
|
||||
if (m_isRecording.compare_exchange_strong(expected, true))
|
||||
{
|
||||
|
||||
// Create our MediaStreamSource
|
||||
if(m_audioGenerator) {
|
||||
|
||||
co_await m_audioGenerator->InitializeAsync();
|
||||
m_streamSource = winrt::MediaStreamSource(m_videoDescriptor, winrt::AudioStreamDescriptor(m_audioGenerator->GetEncodingProperties()));
|
||||
}
|
||||
else {
|
||||
|
||||
m_streamSource = winrt::MediaStreamSource(m_videoDescriptor);
|
||||
}
|
||||
m_streamSource.BufferTime(std::chrono::seconds(0));
|
||||
m_streamSource.Starting({ this, &VideoRecordingSession::OnMediaStreamSourceStarting });
|
||||
m_streamSource.SampleRequested({ this, &VideoRecordingSession::OnMediaStreamSourceSampleRequested });
|
||||
|
||||
// Create our transcoder
|
||||
m_transcoder = winrt::MediaTranscoder();
|
||||
m_transcoder.HardwareAccelerationEnabled(true);
|
||||
|
||||
auto self = shared_from_this();
|
||||
|
||||
// Start encoding
|
||||
auto transcode = co_await m_transcoder.PrepareMediaStreamSourceTranscodeAsync(m_streamSource, m_stream, m_encodingProfile);
|
||||
co_await transcode.TranscodeAsync();
|
||||
}
|
||||
co_return;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::Close
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void VideoRecordingSession::Close()
|
||||
{
|
||||
auto expected = false;
|
||||
if (m_closed.compare_exchange_strong(expected, true))
|
||||
{
|
||||
expected = true;
|
||||
if (!m_isRecording.compare_exchange_strong(expected, false))
|
||||
{
|
||||
CloseInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frameWait->StopCapture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::CloseInternal
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void VideoRecordingSession::CloseInternal()
|
||||
{
|
||||
if(m_audioGenerator) {
|
||||
m_audioGenerator->Stop();
|
||||
}
|
||||
m_frameWait->StopCapture();
|
||||
m_itemClosed.revoke();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::OnMediaStreamSourceStarting
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void VideoRecordingSession::OnMediaStreamSourceStarting(
|
||||
winrt::MediaStreamSource const&,
|
||||
winrt::MediaStreamSourceStartingEventArgs const& args)
|
||||
{
|
||||
auto frame = m_frameWait->TryGetNextFrame();
|
||||
if (frame) {
|
||||
args.Request().SetActualStartPosition(frame->SystemRelativeTime);
|
||||
if (m_audioGenerator) {
|
||||
|
||||
m_audioGenerator->Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::Create
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
std::shared_ptr<VideoRecordingSession> VideoRecordingSession::Create(
|
||||
winrt::IDirect3DDevice const& device,
|
||||
winrt::GraphicsCaptureItem const& item,
|
||||
RECT const& crop,
|
||||
uint32_t frameRate,
|
||||
bool captureAudio,
|
||||
winrt::Streams::IRandomAccessStream const& stream)
|
||||
{
|
||||
return std::shared_ptr<VideoRecordingSession>(new VideoRecordingSession(device, item, crop, frameRate, captureAudio, stream));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// VideoRecordingSession::OnMediaStreamSourceSampleRequested
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
void VideoRecordingSession::OnMediaStreamSourceSampleRequested(
|
||||
winrt::MediaStreamSource const&,
|
||||
winrt::MediaStreamSourceSampleRequestedEventArgs const& args)
|
||||
{
|
||||
auto request = args.Request();
|
||||
auto streamDescriptor = request.StreamDescriptor();
|
||||
if (auto videoStreamDescriptor = streamDescriptor.try_as<winrt::VideoStreamDescriptor>())
|
||||
{
|
||||
if (auto frame = m_frameWait->TryGetNextFrame())
|
||||
{
|
||||
try
|
||||
{
|
||||
auto timeStamp = frame->SystemRelativeTime;
|
||||
auto contentSize = frame->ContentSize;
|
||||
auto frameTexture = GetDXGIInterfaceFromObject<ID3D11Texture2D>(frame->FrameTexture);
|
||||
D3D11_TEXTURE2D_DESC desc = {};
|
||||
frameTexture->GetDesc(&desc);
|
||||
|
||||
winrt::com_ptr<ID3D11Texture2D> backBuffer;
|
||||
winrt::check_hresult(m_previewSwapChain->GetBuffer(0, winrt::guid_of<ID3D11Texture2D>(), backBuffer.put_void()));
|
||||
|
||||
// Use the smaller of the crop size or content size. The content
|
||||
// size can change while recording, for example by resizing the
|
||||
// window. This ensures that only valid content is copied.
|
||||
auto width = min(m_rcCrop.right - m_rcCrop.left, contentSize.Width);
|
||||
auto height = min(m_rcCrop.bottom - m_rcCrop.top, contentSize.Height);
|
||||
|
||||
// Set the content region to copy and clamp the coordinates to the
|
||||
// texture surface.
|
||||
D3D11_BOX region = {};
|
||||
region.left = std::clamp(m_rcCrop.left, static_cast<LONG>(0), static_cast<LONG>(desc.Width));
|
||||
region.right = std::clamp(m_rcCrop.left + width, static_cast<LONG>(0), static_cast<LONG>(desc.Width));
|
||||
region.top = std::clamp(m_rcCrop.top, static_cast<LONG>(0), static_cast<LONG>(desc.Height));
|
||||
region.bottom = std::clamp(m_rcCrop.top + height, static_cast<LONG>(0), static_cast<LONG>(desc.Height));
|
||||
region.back = 1;
|
||||
|
||||
m_d3dContext->ClearRenderTargetView(m_renderTargetView.get(), CLEAR_COLOR);
|
||||
m_d3dContext->CopySubresourceRegion(
|
||||
backBuffer.get(),
|
||||
0,
|
||||
0, 0, 0,
|
||||
frameTexture.get(),
|
||||
0,
|
||||
®ion);
|
||||
|
||||
desc = {};
|
||||
backBuffer->GetDesc(&desc);
|
||||
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
winrt::com_ptr<ID3D11Texture2D> sampleTexture;
|
||||
winrt::check_hresult(m_d3dDevice->CreateTexture2D(&desc, nullptr, sampleTexture.put()));
|
||||
m_d3dContext->CopyResource(sampleTexture.get(), backBuffer.get());
|
||||
auto dxgiSurface = sampleTexture.as<IDXGISurface>();
|
||||
auto sampleSurface = CreateDirect3DSurface(dxgiSurface.get());
|
||||
|
||||
DXGI_PRESENT_PARAMETERS presentParameters{};
|
||||
winrt::check_hresult(m_previewSwapChain->Present1(0, 0, &presentParameters));
|
||||
|
||||
auto sample = winrt::MediaStreamSample::CreateFromDirect3D11Surface(sampleSurface, timeStamp);
|
||||
request.Sample(sample);
|
||||
}
|
||||
catch (winrt::hresult_error const& error)
|
||||
{
|
||||
OutputDebugStringW(error.message().c_str());
|
||||
request.Sample(nullptr);
|
||||
CloseInternal();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Sample(nullptr);
|
||||
CloseInternal();
|
||||
}
|
||||
}
|
||||
else if (auto audioStreamDescriptor = streamDescriptor.try_as<winrt::AudioStreamDescriptor>())
|
||||
{
|
||||
if (auto sample = m_audioGenerator->TryGetNextSample())
|
||||
{
|
||||
request.Sample(sample.value());
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Sample(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
71
src/modules/ZoomIt/ZoomIt/VideoRecordingSession.h
Normal file
71
src/modules/ZoomIt/ZoomIt/VideoRecordingSession.h
Normal file
@@ -0,0 +1,71 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Video capture code derived from https://github.com/robmikh/capturevideosample
|
||||
//
|
||||
//==============================================================================
|
||||
#pragma once
|
||||
|
||||
#include "CaptureFrameWait.h"
|
||||
#include "AudioSampleGenerator.h"
|
||||
#include <d3d11_4.h>
|
||||
|
||||
class VideoRecordingSession : public std::enable_shared_from_this<VideoRecordingSession>
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] static std::shared_ptr<VideoRecordingSession> Create(
|
||||
winrt::Direct3D11::IDirect3DDevice const& device,
|
||||
winrt::GraphicsCaptureItem const& item,
|
||||
RECT const& cropRect,
|
||||
uint32_t frameRate,
|
||||
bool captureAudio,
|
||||
winrt::Streams::IRandomAccessStream const& stream);
|
||||
~VideoRecordingSession();
|
||||
|
||||
winrt::IAsyncAction StartAsync();
|
||||
void EnableCursorCapture(bool enable = true) { m_frameWait->EnableCursorCapture(enable); }
|
||||
void Close();
|
||||
|
||||
private:
|
||||
VideoRecordingSession(
|
||||
winrt::Direct3D11::IDirect3DDevice const& device,
|
||||
winrt::Capture::GraphicsCaptureItem const& item,
|
||||
RECT const cropRect,
|
||||
uint32_t frameRate,
|
||||
bool captureAudio,
|
||||
winrt::Streams::IRandomAccessStream const& stream);
|
||||
void CloseInternal();
|
||||
|
||||
void OnMediaStreamSourceStarting(
|
||||
winrt::MediaStreamSource const& sender,
|
||||
winrt::MediaStreamSourceStartingEventArgs const& args);
|
||||
void OnMediaStreamSourceSampleRequested(
|
||||
winrt::MediaStreamSource const& sender,
|
||||
winrt::MediaStreamSourceSampleRequestedEventArgs const& args);
|
||||
|
||||
private:
|
||||
winrt::Direct3D11::IDirect3DDevice m_device{ nullptr };
|
||||
winrt::com_ptr<ID3D11Device> m_d3dDevice;
|
||||
winrt::com_ptr<ID3D11DeviceContext> m_d3dContext;
|
||||
RECT m_rcCrop;
|
||||
|
||||
winrt::GraphicsCaptureItem m_item{ nullptr };
|
||||
winrt::GraphicsCaptureItem::Closed_revoker m_itemClosed;
|
||||
std::shared_ptr<CaptureFrameWait> m_frameWait;
|
||||
|
||||
winrt::Streams::IRandomAccessStream m_stream{ nullptr };
|
||||
winrt::MediaEncodingProfile m_encodingProfile{ nullptr };
|
||||
winrt::VideoStreamDescriptor m_videoDescriptor{ nullptr };
|
||||
winrt::MediaStreamSource m_streamSource{ nullptr };
|
||||
winrt::MediaTranscoder m_transcoder{ nullptr };
|
||||
|
||||
std::unique_ptr<AudioSampleGenerator> m_audioGenerator;
|
||||
|
||||
winrt::com_ptr<IDXGISwapChain1> m_previewSwapChain;
|
||||
winrt::com_ptr<ID3D11RenderTargetView> m_renderTargetView;
|
||||
|
||||
std::atomic<bool> m_isRecording = false;
|
||||
std::atomic<bool> m_closed = false;
|
||||
};
|
||||
223
src/modules/ZoomIt/ZoomIt/ZoomIt.h
Normal file
223
src/modules/ZoomIt/ZoomIt/ZoomIt.h
Normal file
@@ -0,0 +1,223 @@
|
||||
//============================================================================
|
||||
//
|
||||
// Zoomit
|
||||
// Copyright (C) Mark Russinovich
|
||||
// Sysinternals - www.sysinternals.com
|
||||
//
|
||||
// Screen zoom and annotation tool.
|
||||
//
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//============================================================================
|
||||
#pragma once
|
||||
|
||||
// Ignore getversion deprecation warning
|
||||
#pragma warning( disable: 4996 )
|
||||
|
||||
typedef HRESULT (__stdcall * type_pEnableThemeDialogTexture)(
|
||||
HWND hwnd,
|
||||
DWORD dwFlags
|
||||
);
|
||||
type_pEnableThemeDialogTexture pEnableThemeDialogTexture;
|
||||
|
||||
// For testing anti-aliased bitmap stretching
|
||||
#define SCALE_GDIPLUS 0
|
||||
#define SCALE_HALFTONE 0
|
||||
|
||||
// sent in mouse message when coming from tablet pen
|
||||
#define MI_WP_SIGNATURE 0xFF515700
|
||||
|
||||
#define ZOOM_LEVEL_MIN 1
|
||||
#define ZOOM_LEVEL_INIT 2
|
||||
#define ZOOM_LEVEL_STEP_IN ((float) 1.1)
|
||||
#define ZOOM_LEVEL_STEP_OUT ((float) 0.8)
|
||||
#define ZOOM_LEVEL_MAX 32
|
||||
#define ZOOM_LEVEL_STEP_TIME 20
|
||||
|
||||
#define LIVEZOOM_MOVE_REGIONS 8
|
||||
|
||||
#define WIN7_VERSION 0x106
|
||||
#define WIN10_VERSION 0x206
|
||||
|
||||
// Time that we'll cache live zoom window to avoid flicker
|
||||
// of live zooming on Vista/ws2k8
|
||||
#define LIVEZOOM_WINDOW_TIMEOUT 2*3600*1000
|
||||
|
||||
#define MAX_UNDO_HISTORY 32
|
||||
|
||||
#define PEN_WIDTH 5
|
||||
#define MIN_PEN_WIDTH 2
|
||||
#define MAX_PEN_WIDTH 40
|
||||
#define MAX_LIVE_PEN_WIDTH 600
|
||||
|
||||
#define APPNAME L"ZoomIt"
|
||||
#define WM_USER_TRAY_ACTIVATE WM_USER+100
|
||||
#define WM_USER_TYPING_OFF WM_USER+101
|
||||
#define WM_USER_GET_ZOOM_LEVEL WM_USER+102
|
||||
#define WM_USER_GET_SOURCE_RECT WM_USER+103
|
||||
#define WM_USER_SET_ZOOM WM_USER+104
|
||||
#define WM_USER_STOP_RECORDING WM_USER+105
|
||||
#define WM_USER_SAVE_CURSOR WM_USER+106
|
||||
#define WM_USER_RESTORE_CURSOR WM_USER+107
|
||||
#define WM_USER_MAGNIFY_CURSOR WM_USER+108
|
||||
#define WM_USER_EXIT_MODE WM_USER+109
|
||||
#define WM_USER_RELOAD_SETTINGS WM_USER+110
|
||||
|
||||
typedef struct _TYPED_KEY {
|
||||
RECT rc;
|
||||
struct _TYPED_KEY *Next;
|
||||
} TYPED_KEY, *P_TYPED_KEY;
|
||||
|
||||
typedef struct _DRAW_UNDO {
|
||||
HDC hDc;
|
||||
HBITMAP hBitmap;
|
||||
struct _DRAW_UNDO *Next;
|
||||
} DRAW_UNDO, *P_DRAW_UNDO;
|
||||
|
||||
typedef struct {
|
||||
TCHAR TabTitle[64];
|
||||
HWND hPage;
|
||||
} OPTION_TABS, *P_OPTIONS_TABS;
|
||||
|
||||
#define COLOR_RED RGB(255, 0, 0)
|
||||
#define COLOR_GREEN RGB(0, 255, 0)
|
||||
#define COLOR_BLUE RGB(0, 0, 255)
|
||||
#define COLOR_ORANGE RGB(255,128,0)
|
||||
#define COLOR_YELLOW RGB(255, 255, 0 )
|
||||
#define COLOR_PINK RGB(255,128,255)
|
||||
#define COLOR_BLUR RGB(112,112,112)
|
||||
|
||||
#define DRAW_RECTANGLE 1
|
||||
#define DRAW_ELLIPSE 2
|
||||
#define DRAW_LINE 3
|
||||
#define DRAW_ARROW 4
|
||||
|
||||
#define SHALLOW_ZOOM 1
|
||||
#define SHALLOW_DESTROY 2
|
||||
#define LIVE_DRAW_ZOOM 3
|
||||
|
||||
#define PEN_COLOR_HIGHLIGHT(Pencolor) (Pencolor >> 24) != 0xFF
|
||||
|
||||
|
||||
typedef BOOL (__stdcall *type_pGetMonitorInfo)(
|
||||
HMONITOR hMonitor, // handle to display monitor
|
||||
LPMONITORINFO lpmi // display monitor information
|
||||
);
|
||||
|
||||
typedef HMONITOR (__stdcall *type_MonitorFromPoint)(
|
||||
POINT pt, // point
|
||||
DWORD dwFlags // determine return value
|
||||
);
|
||||
|
||||
typedef HRESULT (__stdcall *type_pSHAutoComplete)(
|
||||
HWND hwndEdit,
|
||||
DWORD dwFlags
|
||||
);
|
||||
|
||||
// DPI awareness
|
||||
typedef BOOL (__stdcall *type_pSetProcessDPIAware)(void);
|
||||
|
||||
// Live zoom
|
||||
typedef BOOL (__stdcall *type_pMagSetWindowSource)(HWND hwnd,
|
||||
RECT rect
|
||||
);
|
||||
typedef BOOL (__stdcall *type_pMagSetWindowTransform)(HWND hwnd,
|
||||
PMAGTRANSFORM pTransform
|
||||
);
|
||||
typedef BOOL(__stdcall* type_pMagSetFullscreenTransform)(
|
||||
float magLevel,
|
||||
int xOffset,
|
||||
int yOffset
|
||||
);
|
||||
typedef BOOL(__stdcall* type_pMagSetInputTransform)(
|
||||
BOOL fEnabled,
|
||||
const LPRECT pRectSource,
|
||||
const LPRECT pRectDest
|
||||
);
|
||||
typedef BOOL (__stdcall *type_pMagShowSystemCursor)(
|
||||
BOOL fShowCursor
|
||||
);
|
||||
typedef BOOL(__stdcall *type_pMagSetWindowFilterList)(
|
||||
HWND hwnd,
|
||||
DWORD dwFilterMode,
|
||||
int count,
|
||||
HWND* pHWND
|
||||
);
|
||||
typedef BOOL (__stdcall *type_pMagInitialize)(VOID);
|
||||
|
||||
typedef BOOL(__stdcall *type_pGetPointerType)(
|
||||
_In_ UINT32 pointerId,
|
||||
_Out_ POINTER_INPUT_TYPE *pointerType
|
||||
);
|
||||
|
||||
typedef BOOL(__stdcall *type_pGetPointerPenInfo)(
|
||||
_In_ UINT32 pointerId,
|
||||
_Out_ POINTER_PEN_INFO *penInfo
|
||||
);
|
||||
|
||||
typedef HRESULT (__stdcall *type_pDwmIsCompositionEnabled)(
|
||||
BOOL *pfEnabled
|
||||
);
|
||||
|
||||
// opacity
|
||||
typedef BOOL (__stdcall *type_pSetLayeredWindowAttributes)(
|
||||
HWND hwnd, // handle to the layered window
|
||||
COLORREF crKey, // specifies the color key
|
||||
BYTE bAlpha, // value for the blend function
|
||||
DWORD dwFlags // action
|
||||
);
|
||||
|
||||
// Presentation mode check
|
||||
typedef HRESULT (__stdcall *type_pSHQueryUserNotificationState)(
|
||||
QUERY_USER_NOTIFICATION_STATE *pQueryUserNotificationState
|
||||
);
|
||||
|
||||
typedef BOOL (__stdcall *type_pSystemParametersInfoForDpi)(
|
||||
UINT uiAction,
|
||||
UINT uiParam,
|
||||
PVOID pvParam,
|
||||
UINT fWinIni,
|
||||
UINT dpi
|
||||
);
|
||||
|
||||
typedef UINT (__stdcall *type_pGetDpiForWindow)(
|
||||
HWND hwnd
|
||||
);
|
||||
|
||||
class ComputerGraphicsInit
|
||||
{
|
||||
ULONG_PTR m_Token;
|
||||
public:
|
||||
ComputerGraphicsInit()
|
||||
{
|
||||
Gdiplus::GdiplusStartupOutput startupOut;
|
||||
Gdiplus::GdiplusStartupInput startupIn;
|
||||
Gdiplus::GdiplusStartup( &m_Token, &startupIn, &startupOut );
|
||||
}
|
||||
~ComputerGraphicsInit()
|
||||
{
|
||||
Gdiplus::GdiplusShutdown( m_Token );
|
||||
}
|
||||
};
|
||||
|
||||
// Direct3D
|
||||
typedef HRESULT (__stdcall *type_pCreateDirect3D11DeviceFromDXGIDevice)(
|
||||
IDXGIDevice *dxgiDevice,
|
||||
IInspectable **graphicsDevice
|
||||
);
|
||||
typedef HRESULT (__stdcall *type_pCreateDirect3D11SurfaceFromDXGISurface)(
|
||||
IDXGISurface *dxgiSurface,
|
||||
IInspectable **graphicsSurface
|
||||
);
|
||||
typedef HRESULT (__stdcall *type_pD3D11CreateDevice)(
|
||||
IDXGIAdapter *pAdapter,
|
||||
D3D_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
UINT Flags,
|
||||
const D3D_FEATURE_LEVEL *pFeatureLevels,
|
||||
UINT FeatureLevels,
|
||||
UINT SDKVersion,
|
||||
ID3D11Device **ppDevice,
|
||||
D3D_FEATURE_LEVEL *pFeatureLevel,
|
||||
ID3D11DeviceContext **ppImmediateContext
|
||||
);
|
||||
1
src/modules/ZoomIt/ZoomIt/ZoomIt.idc
Normal file
1
src/modules/ZoomIt/ZoomIt/ZoomIt.idc
Normal file
@@ -0,0 +1 @@
|
||||
<Configurations active="Default"><Configuration name="Default"><Command val=""></Command><RunMode val="a host path through a shared folder"></RunMode><ShareFolders val=""></ShareFolders><RemoteDebugMonitor val="C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86\msvsmon.exe"></RemoteDebugMonitor><MonitorName val="VMDebug"></MonitorName><VirtualMachine val=""></VirtualMachine><StartMode val="No"></StartMode><TerminationMode val="No operation"></TerminationMode><CopyFiles val=""></CopyFiles><PreCommandLine val=""></PreCommandLine><PostCommandLine val=""></PostCommandLine></Configuration></Configurations>
|
||||
484
src/modules/ZoomIt/ZoomIt/ZoomIt.rc
Normal file
484
src/modules/ZoomIt/ZoomIt/ZoomIt.rc
Normal file
@@ -0,0 +1,484 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
// version.h and branding.h are different in the Sysinternals repository,
|
||||
// keep the includes as such, here.
|
||||
// From $(MSBuildThisFileDirectory)..\..\..\common\version
|
||||
#include "version.h"
|
||||
// From $(MSBuildThisFileDirectory)PowerToys
|
||||
#include "branding.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""binres.rc""\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Cursor
|
||||
//
|
||||
|
||||
NULLCURSOR CURSOR "cursor1.cur"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
APPICON ICON "appicon.ico"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FILE_VERSION
|
||||
PRODUCTVERSION PRODUCT_VERSION
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", COMPANY_NAME
|
||||
VALUE "FileDescription", FILE_DESCRIPTION
|
||||
VALUE "FileVersion", FILE_VERSION_STRING
|
||||
VALUE "InternalName", INTERNAL_NAME
|
||||
VALUE "LegalCopyright", COPYRIGHT_NOTE
|
||||
VALUE "OriginalFilename", ORIGINAL_FILENAME
|
||||
VALUE "ProductName", ZOOMIT_PRODUCT_NAME
|
||||
VALUE "ProductVersion", PRODUCT_VERSION_STRING
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
OPTIONS DIALOGEX 0, 0, 279, 325
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_CONTROLPARENT
|
||||
CAPTION "ZoomIt - Sysinternals: www.sysinternals.com"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,166,306,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,223,306,50,14
|
||||
LTEXT "ZoomIt v9.0",IDC_VERSION,42,7,73,10
|
||||
LTEXT "Copyright <20> 2006-2024 Mark Russinovich",IDC_COPYRIGHT,42,17,166,8
|
||||
CONTROL "<a HREF=""https://www.sysinternals.com"">Sysinternals - www.sysinternals.com</a>",IDC_LINK,
|
||||
"SysLink",WS_TABSTOP,42,26,150,9
|
||||
ICON "APPICON",IDC_STATIC,12,9,20,20
|
||||
CONTROL "Show tray icon",IDC_SHOW_TRAY_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,295,105,10
|
||||
CONTROL "",IDC_TAB,"SysTabControl32",TCS_MULTILINE | WS_TABSTOP,8,46,265,245
|
||||
CONTROL "Run ZoomIt when Windows starts",IDC_AUTOSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,309,122,10
|
||||
END
|
||||
|
||||
ADVANCED_BREAK DIALOGEX 0, 0, 209, 219
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Advanced Break Options"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "Play Sound on Expiration:",IDC_CHECK_SOUND_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,11,98,10,WS_EX_RIGHT
|
||||
EDITTEXT IDC_SOUND_FILE,61,38,125,12,ES_AUTOHSCROLL | ES_READONLY
|
||||
PUSHBUTTON "&...",IDC_SOUND_BROWSE,187,38,13,11
|
||||
COMBOBOX IDC_OPACITY,62,58,38,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "",IDC_TIMER_POS1,"Button",BS_AUTORADIOBUTTON,63,78,10,10
|
||||
CONTROL "",IDC_TIMER_POS2,"Button",BS_AUTORADIOBUTTON,79,78,10,10
|
||||
CONTROL "",IDC_TIMER_POS3,"Button",BS_AUTORADIOBUTTON,97,78,10,10
|
||||
CONTROL "",IDC_TIMER_POS4,"Button",BS_AUTORADIOBUTTON,63,93,10,10
|
||||
CONTROL "",IDC_TIMER_POS5,"Button",BS_AUTORADIOBUTTON,79,93,10,10
|
||||
CONTROL "",IDC_TIMER_POS6,"Button",BS_AUTORADIOBUTTON,97,93,10,10
|
||||
CONTROL "",IDC_TIMER_POS7,"Button",BS_AUTORADIOBUTTON,63,108,10,10
|
||||
CONTROL "",IDC_TIMER_POS8,"Button",BS_AUTORADIOBUTTON,79,108,10,10
|
||||
CONTROL "",IDC_TIMER_POS9,"Button",BS_AUTORADIOBUTTON,97,108,10,10
|
||||
CONTROL "Show background bitmap:",IDC_CHECK_BACKGROUND_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,122,99,10,WS_EX_RIGHT
|
||||
CONTROL "Use faded desktop as background",IDC_STATIC_DESKTOP_BACKGROUND,
|
||||
"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,46,135,125,10
|
||||
CONTROL "Use image file as background",IDC_STATIC_BACKGROUND_FILE,
|
||||
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,46,149,109,10
|
||||
EDITTEXT IDC_BACKGROUND_FILE,62,164,125,12,ES_AUTOHSCROLL | ES_READONLY
|
||||
PUSHBUTTON "&...",IDC_BACKGROUND_BROWSE,188,164,13,11
|
||||
CONTROL "Scale to screen:",IDC_CHECK_BACKGROUND_STRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,58,180,67,10,WS_EX_RIGHT
|
||||
DEFPUSHBUTTON "OK",IDOK,97,201,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,150,201,50,14
|
||||
LTEXT "Alarm Sound File:",IDC_STATIC_SOUND_FILE,61,26,56,8
|
||||
LTEXT "Timer Opacity:",IDC_STATIC,8,59,48,8
|
||||
LTEXT "Timer Position:",IDC_STATIC,8,77,48,8
|
||||
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,7,196,193,1,WS_EX_CLIENTEDGE
|
||||
END
|
||||
|
||||
ZOOM DIALOGEX 0, 0, 260, 158
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,59,57,80,12
|
||||
LTEXT "After toggling ZoomIt you can zoom in with the mouse wheel or up and down arrow keys. Exit zoom mode with Escape or by pressing the right mouse button.",IDC_STATIC,7,6,246,26
|
||||
LTEXT "Zoom Toggle:",IDC_STATIC,7,59,51,8
|
||||
CONTROL "",IDC_ZOOM_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,53,104,150,15,WS_EX_TRANSPARENT
|
||||
LTEXT "Specify the initial level of magnification when zooming in:",IDC_STATIC,7,91,215,10
|
||||
LTEXT "1.25",IDC_STATIC,52,122,16,8
|
||||
LTEXT "1.5",IDC_STATIC,82,122,12,8
|
||||
LTEXT "1.75",IDC_STATIC,108,122,16,8
|
||||
LTEXT "2.0",IDC_STATIC,138,122,12,8
|
||||
LTEXT "3.0",IDC_STATIC,164,122,12,8
|
||||
LTEXT "4.0",IDC_STATIC,190,122,12,8
|
||||
CONTROL "Animate zoom in and zoom out:",IDC_ANIMATE_ZOOM,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,7,74,116,10
|
||||
LTEXT "Copy a zoomed screen with Ctrl+C or save it by typing Ctrl+S. Crop the copy or save region by entering Ctrl+Shift instead of Ctrl.",IDC_STATIC,7,34,246,17
|
||||
END
|
||||
|
||||
DRAW DIALOGEX 0, 0, 260, 228
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "Once zoomed, toggle drawing mode by pressing the left mouse button. Undo with Ctrl+Z and all drawing by pressing E. Center the cursor with the space bar. Exit drawing mode by pressing the right mouse button.",IDC_STATIC,7,7,246,24
|
||||
LTEXT "Pen Control ",IDC_PEN_CONTROL,7,38,40,8
|
||||
LTEXT "Change the pen width by pressing left Ctrl and using the mouse wheel or the up and down arrow keys.",IDC_STATIC,19,48,233,16
|
||||
LTEXT "Colors",IDC_COLORS,7,70,21,8
|
||||
LTEXT "Change the pen color by pressing R (red), G (green), B (blue),\nO (orange), Y (yellow) or P (pink).",IDC_STATIC,19,80,233,16
|
||||
LTEXT "Highlight and Blur",IDC_HIGHLIGHT_AND_BLUR,7,102,58,8
|
||||
LTEXT "Hold Shift while pressing a color key for a translucent highlighter color. Press X for blur or Shift+X for a stronger blur.",IDC_STATIC,19,113,233,16
|
||||
LTEXT "Shapes",IDC_SHAPES,7,134,23,8
|
||||
LTEXT "Draw a line by holding down the Shift key, a rectangle with the Ctrl key, an ellipse with the Tab key and an arrow with Shift+Ctrl.",IDC_STATIC,19,144,233,16
|
||||
LTEXT "Screen",IDC_SCREEN,7,166,22,8
|
||||
LTEXT "Clear the screen for a sketch pad by pressing W (white) or K (black). Copy a zoomed screen with Ctrl+C or save it by typing Ctrl+S. Crop the copy or save region by entering Ctrl+Shift instead of Ctrl.",IDC_STATIC,19,176,233,24
|
||||
CONTROL "",IDC_DRAW_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,73,207,80,12
|
||||
LTEXT "Draw w/out Zoom:",IDC_STATIC,7,210,63,11
|
||||
END
|
||||
|
||||
TYPE DIALOGEX 0, 0, 260, 104
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "Once in drawing mode, type 't' to enter typing mode or shift+'t' to enter typing mode with right-aligned input. Exit typing mode by pressing escape or the left mouse button. Use the mouse wheel or up and down arrow keys to change the font size.",IDC_STATIC,7,7,246,32
|
||||
LTEXT "The text color is the current drawing color.",IDC_STATIC,7,47,211,9
|
||||
PUSHBUTTON "&Font",IDC_FONT,112,69,41,14
|
||||
GROUPBOX "Text Font",IDC_TEXT_FONT,8,61,99,28
|
||||
END
|
||||
|
||||
BREAK DIALOGEX 0, 0, 260, 123
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_BREAK_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,52,67,80,12
|
||||
EDITTEXT IDC_TIMER,31,86,31,13,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SPIN_TIMER,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,45,86,11,12
|
||||
LTEXT "minutes",IDC_STATIC,67,88,25,8
|
||||
PUSHBUTTON "&Advanced",IDC_ADVANCED_BREAK,212,102,41,14
|
||||
LTEXT "Enter timer mode by using the ZoomIt tray icon's Break menu item. Increase and decrease time with the arrow keys. If you Alt-Tab away from the timer window, reactivate it by left-clicking on the ZoomIt tray icon. Exit timer mode with Escape. ",IDC_STATIC,7,7,246,33
|
||||
LTEXT "Start Timer:",IDC_STATIC,7,70,39,8
|
||||
LTEXT "Timer:",IDC_STATIC,7,88,20,8
|
||||
LTEXT "Change the break timer color using the same keys that the drawing color. The break timer font is the same as text font.",IDC_STATIC,7,45,219,20
|
||||
CONTROL "Show Time Elapsed After Expiration:",IDC_CHECK_SHOW_EXPIRED,
|
||||
"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,8,104,132,10
|
||||
END
|
||||
|
||||
1543 DIALOGEX 100, 50, 216, 131
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "ZoomIt Font"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "&Font:",1088,6,0,40,9
|
||||
COMBOBOX 1136,6,10,94,64,CBS_SIMPLE | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Font St&yle:",1089,108,0,44,9
|
||||
COMBOBOX 1137,108,10,64,64,CBS_SIMPLE | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "&Size:",1090,179,0,30,9
|
||||
COMBOBOX 1138,179,10,32,64,CBS_SIMPLE | CBS_OWNERDRAWFIXED | CBS_SORT | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,166,94,45,14,WS_GROUP
|
||||
PUSHBUTTON "Cancel",IDCANCEL,166,111,45,14,WS_GROUP
|
||||
GROUPBOX "Sample",1073,7,75,143,51,WS_GROUP
|
||||
CTEXT "AaBbYyZz",1092,16,88,127,31,SS_NOPREFIX | NOT WS_VISIBLE
|
||||
END
|
||||
|
||||
LIVEZOOM DIALOGEX 0, 0, 260, 134
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_LIVE_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,69,108,80,12
|
||||
LTEXT "LiveZoom mode is supported on Windows 7 and higher where window updates show while zoomed. ",IDC_STATIC,7,7,246,18
|
||||
LTEXT "LiveZoom Toggle:",IDC_STATIC,7,110,62,8
|
||||
LTEXT "To enter and exit LiveZoom, enter the hotkey specified below.",IDC_STATIC,7,94,218,13
|
||||
LTEXT "Note that in LiveZoom you must use Ctrl+Up and Ctrl+Down to control the zoom level. To enter drawing mode, use the standard zoom-without-draw hotkey and then escape to go back to LiveZoom.",IDC_STATIC,7,30,246,27
|
||||
LTEXT "Use LiveDraw to draw and annotate the live desktop. To activate LiveDraw, enter the hotkey with the Shift key in the opposite mode. You can remove LiveDraw annotations by activating LiveDraw and enter the escape key",IDC_STATIC,7,62,246,32
|
||||
END
|
||||
|
||||
RECORD DIALOGEX 0, 0, 260, 169
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_RECORD_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,61,96,80,12
|
||||
LTEXT "Record Toggle:",IDC_STATIC,7,98,54,8
|
||||
LTEXT "Record video of the unzoomed live screen or a static zoomed session by entering the recording hot key and finish the recording by entering it again. ",IDC_STATIC,7,7,246,28
|
||||
LTEXT "Note: Recording is only available on Windows 10 (version 1903) and higher.",IDC_STATIC,7,77,246,19
|
||||
LTEXT "Scaling:",IDC_STATIC,30,115,26,8
|
||||
COMBOBOX IDC_RECORD_SCALING,61,114,26,30,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_OEMCONVERT | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Frame Rate:",IDC_STATIC,119,115,44,8,NOT WS_VISIBLE
|
||||
COMBOBOX IDC_RECORD_FRAME_RATE,166,114,42,30,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_OEMCONVERT | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "To crop the portion of the screen that will be recorded, enter the hotkey with the Shift key in the opposite mode. ",IDC_STATIC,7,32,246,19
|
||||
LTEXT "To record a specific window, enter the hotkey with the Alt key in the opposite mode.",IDC_STATIC,7,55,246,19
|
||||
CONTROL "&Capture audio input:",IDC_CAPTURE_AUDIO,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,7,137,83,10
|
||||
COMBOBOX IDC_MICROPHONE,81,152,172,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Microphone:",IDC_STATIC,32,154,47,8
|
||||
END
|
||||
|
||||
SNIP DIALOGEX 0, 0, 260, 68
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_SNIP_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,55,32,80,12
|
||||
LTEXT "Snip Toggle:",IDC_STATIC,7,33,45,8
|
||||
LTEXT "Copy a region of the screen to the clipboard or enter the hotkey with the Shift key in the opposite mode to save it to a file. ",IDC_STATIC,7,7,246,19
|
||||
END
|
||||
|
||||
DEMOTYPE DIALOGEX 0, 0, 259, 249
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_DEMOTYPE_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,74,154,80,12
|
||||
LTEXT "DemoType toggle:",IDC_STATIC,7,157,63,8
|
||||
PUSHBUTTON "&...",IDC_DEMOTYPE_BROWSE,231,137,16,13
|
||||
CONTROL "",IDC_DEMOTYPE_SPEED_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,52,202,150,11,WS_EX_TRANSPARENT
|
||||
CONTROL "Drive input with typing:",IDC_DEMOTYPE_USER_DRIVEN,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,7,173,88,10
|
||||
LTEXT "DemoType typing speed:",IDC_STATIC,7,189,215,10
|
||||
LTEXT "Slow",IDC_DEMOTYPE_STATIC1,51,213,18,8
|
||||
LTEXT "Fast",IDC_DEMOTYPE_STATIC2,186,213,17,8
|
||||
EDITTEXT IDC_DEMOTYPE_FILE,44,137,187,12,ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "Input file:",IDC_STATIC,7,139,32,8
|
||||
LTEXT "When you reach the end of the file, ZoomIt will reload the file and start at the beginning. Enter the hotkey with the Shift key in the opposite mode to step back to the last [end].",IDC_STATIC,7,108,248,24
|
||||
LTEXT "DemoType has ZoomIt type text specified in the input file when you enter the DemoType toggle. Simply separate snippets with the [end] keyword, or you can insert text from the clipboard if it is prefixed with the [start].",IDC_STATIC,7,7,248,24
|
||||
LTEXT " - Insert pauses with the [pause:n] keyword where 'n' is seconds. ",IDC_STATIC,19,34,212,11
|
||||
LTEXT "You can have ZoomIt send text automatically, or select the option to drive input with typing. ZoomIt will block keyboard input while sending output.",IDC_STATIC,7,68,248,16
|
||||
LTEXT "When driving input, hit the space bar to unblock keyboard input at the end of a snippet. In auto mode, control will be returned upon completion.",IDC_STATIC,7,88,248,16
|
||||
LTEXT "- Send text via the clipboard with [paste] and [/paste]. ",IDC_STATIC,23,45,178,8
|
||||
LTEXT "- Send keystrokes with [enter], [up], [down], [left], and [right].",IDC_STATIC,23,56,211,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
"OPTIONS", DIALOG
|
||||
BEGIN
|
||||
RIGHTMARGIN, 273
|
||||
BOTTOMMARGIN, 320
|
||||
END
|
||||
|
||||
"ADVANCED_BREAK", DIALOG
|
||||
BEGIN
|
||||
RIGHTMARGIN, 207
|
||||
BOTTOMMARGIN, 215
|
||||
END
|
||||
|
||||
"ZOOM", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 253
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 151
|
||||
END
|
||||
|
||||
"DRAW", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 253
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 221
|
||||
END
|
||||
|
||||
"TYPE", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 253
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 97
|
||||
END
|
||||
|
||||
"BREAK", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 253
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 116
|
||||
END
|
||||
|
||||
1543, DIALOG
|
||||
BEGIN
|
||||
RIGHTMARGIN, 211
|
||||
BOTTOMMARGIN, 127
|
||||
END
|
||||
|
||||
"LIVEZOOM", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 253
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 127
|
||||
END
|
||||
|
||||
"RECORD", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 253
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 164
|
||||
END
|
||||
|
||||
"SNIP", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 253
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 61
|
||||
END
|
||||
|
||||
"DEMOTYPE", DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 255
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 205
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
ACCELERATORS ACCELERATORS
|
||||
BEGIN
|
||||
"C", IDC_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||
"S", IDC_SAVE, VIRTKEY, CONTROL, NOINVERT
|
||||
"C", IDC_COPY_CROP, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
"S", IDC_SAVE_CROP, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AFX_DIALOG_LAYOUT
|
||||
//
|
||||
|
||||
OPTIONS AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
LIVEZOOM AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
DRAW AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
RECORD AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
TYPE AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
ZOOM AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
SNIP AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
BREAK AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
DEMOTYPE AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#include "binres.rc"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
370
src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj
Normal file
370
src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj
Normal file
@@ -0,0 +1,370 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0A84F764-3A88-44CD-AA96-41BDBD48627B}</ProjectGuid>
|
||||
<RootNamespace>ZoomIt</RootNamespace>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
|
||||
<TargetName>PowerToys.$(MSBuildProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<InterPlatformDir>$(ProjectDir)$(Configuration)\InterPlatform\</InterPlatformDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<InterPlatformDir>$(ProjectDir)$(Configuration)\InterPlatform\</InterPlatformDir>
|
||||
<BinaryDependencyName>RCZOOMIT</BinaryDependencyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<BinaryDependencyName>RCZOOMIT</BinaryDependencyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<InterPlatformDir>$(ProjectDir)$(Configuration)\InterPlatform\</InterPlatformDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<InterPlatformDir>$(ProjectDir)$(Configuration)\InterPlatform\</InterPlatformDir>
|
||||
<BinaryDependencyName>RCZOOMIT</BinaryDependencyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<BinaryDependencyName>RCZOOMIT</BinaryDependencyName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<DisableSpecificWarnings>4100;4091;4245</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>..\..\..\;$(MSBuildThisFileDirectory)..\..\..\common\sysinternals;%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>__ZOOMIT_POWERTOYS__;_UNICODE;UNICODE;WINVER=0x602;NDEBUG;_WIN32_WINNT=0x602;_WIN32_WINDOWS=0x501;WIN32;_WINDOWS;MSVC6=1;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;_M_IX86;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\..\common\version;$(MSBuildThisFileDirectory)PowerToys;$(InterPlatformDir)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>__ZOOMIT_POWERTOYS__;_UNICODE;UNICODE;WINVER=0x602;NDEBUG;_WIN32_WINNT=0x602;_WIN32_WINDOWS=0x501;WIN32;_WINDOWS;MSVC6=1;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;_M_X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\..\common\version;$(MSBuildThisFileDirectory)PowerToys;</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||
<FixedBaseAddress />
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>__ZOOMIT_POWERTOYS__;_UNICODE;UNICODE;WINVER=0x602;NDEBUG;_WIN32_WINNT=0x602;_WIN32_WINDOWS=0x501;WIN32;_WINDOWS;MSVC6=1;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;_M_ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\..\common\version;$(MSBuildThisFileDirectory)PowerToys;</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<FixedBaseAddress>
|
||||
</FixedBaseAddress>
|
||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>__ZOOMIT_POWERTOYS__;_UNICODE;UNICODE;WINVER=0x0602;_DEBUG;_WIN32_WINNT=0x602.MSVC6;_WIN32_WINDOWS=0x600;WIN32;_WINDOWS;_WIN32_WINNT=0x602;MSVC6=1;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_M_IX86;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\..\common\version;$(MSBuildThisFileDirectory)PowerToys;$(InterPlatformDir)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>__ZOOMIT_POWERTOYS__;_UNICODE;UNICODE;WINVER=0x0602;_DEBUG;_WIN32_WINNT=0x602.MSVC6;_WIN32_WINDOWS=0x600;WIN32;_WINDOWS;_WIN32_WINNT=0x602;MSVC6=1;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_M_X64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\..\common\version;$(MSBuildThisFileDirectory)PowerToys;</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;version.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<UACUIAccess>true</UACUIAccess>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>__ZOOMIT_POWERTOYS__;_UNICODE;UNICODE;WINVER=0x0602;_DEBUG;_WIN32_WINNT=0x602.MSVC6;_WIN32_WINDOWS=0x600;WIN32;_WINDOWS;_WIN32_WINNT=0x602;MSVC6=1;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;_M_ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\..\common\version;$(MSBuildThisFileDirectory)PowerToys;</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;version.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<UACUIAccess>true</UACUIAccess>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AudioSampleGenerator.cpp">
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</MultiProcessorCompilation>
|
||||
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\dll.c">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\Eula\eula.c">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\WindowsVersions.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
<ClCompile Include="SelectRectangle.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utility.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DemoType.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VersionHelper.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VideoRecordingSession.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Zoomit.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AudioSampleGenerator.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\Eula\Eula.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\ZoomItModuleInterface\Trace.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="Registry.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="SelectRectangle.h" />
|
||||
<ClInclude Include="Utility.h" />
|
||||
<ClInclude Include="DemoType.h" />
|
||||
<ClInclude Include="VersionHelper.h" />
|
||||
<ClInclude Include="VideoRecordingSession.h" />
|
||||
<ClInclude Include="ZoomIt.h" />
|
||||
<ClInclude Include="ZoomItSettings.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="appicon.ico" />
|
||||
<Image Include="icon1.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\ZoomItModuleInterface\Trace.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CaptureFrameWait.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<None Include="CaptureFrameWait.h" />
|
||||
<None Include="cursor1.cur" />
|
||||
<None Include="hand.cur" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="binres.rc">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||
</ResourceCompile>
|
||||
<ResourceCompile Include="ZoomIt.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\common\Telemetry\EtwTrace\EtwTrace.vcxproj">
|
||||
<Project>{8f021b46-362b-485c-bfba-ccf83e820cbd}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets" Condition="Exists('..\..\..\..\packages\robmikh.common.0.0.23-beta\build\native\robmikh.common.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</Project>
|
||||
130
src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj.filters
Normal file
130
src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj.filters
Normal file
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{73afce48-6609-48fb-86f2-db7b72a1c1ec}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{db948f16-61f7-47ab-96c8-57914076a38a}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{e1fa606f-a2e6-40c8-8779-8ca1813d9f01}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Zoomit.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CaptureFrameWait.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SelectRectangle.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utility.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AudioSampleGenerator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DemoType.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VersionHelper.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VideoRecordingSession.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\ZoomItModuleInterface\Trace.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\dll.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\Eula\eula.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\WindowsVersions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Registry.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZoomIt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SelectRectangle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utility.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AudioSampleGenerator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DemoType.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VersionHelper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VideoRecordingSession.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\ZoomItModuleInterface\Trace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\Eula\Eula.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZoomItSettings.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="appicon.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="icon1.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cursor1.cur">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="hand.cur">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="CaptureFrameWait.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ZoomIt.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
<ResourceCompile Include="binres.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
83
src/modules/ZoomIt/ZoomIt/ZoomItSettings.h
Normal file
83
src/modules/ZoomIt/ZoomIt/ZoomItSettings.h
Normal file
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
#include "zoomit.h"
|
||||
#include "Registry.h"
|
||||
#include "DemoType.h"
|
||||
|
||||
DWORD g_ToggleKey = (HOTKEYF_CONTROL << 8)| '1';
|
||||
DWORD g_LiveZoomToggleKey = ((HOTKEYF_CONTROL) << 8)| '4';
|
||||
DWORD g_DrawToggleKey = ((HOTKEYF_CONTROL) << 8)| '2';
|
||||
DWORD g_BreakToggleKey = ((HOTKEYF_CONTROL) << 8)| '3';
|
||||
DWORD g_DemoTypeToggleKey = ((HOTKEYF_CONTROL) << 8) | '7';
|
||||
DWORD g_RecordToggleKey = ((HOTKEYF_CONTROL) << 8) | '5';
|
||||
DWORD g_SnipToggleKey = ((HOTKEYF_CONTROL) << 8) | '6';
|
||||
|
||||
DWORD g_ShowExpiredTime = 1;
|
||||
DWORD g_SliderZoomLevel = 3;
|
||||
BOOLEAN g_AnimateZoom = TRUE;
|
||||
DWORD g_PenColor = COLOR_RED;
|
||||
DWORD g_BreakPenColor = COLOR_RED;
|
||||
DWORD g_RootPenWidth = PEN_WIDTH;
|
||||
int g_FontScale = 10;
|
||||
DWORD g_BreakTimeout = 10;
|
||||
DWORD g_BreakOpacity = 100;
|
||||
DWORD g_BreakTimerPosition = 4;
|
||||
BOOLEAN g_BreakPlaySoundFile = FALSE;
|
||||
TCHAR g_BreakSoundFile[MAX_PATH] = {0};
|
||||
BOOLEAN g_BreakShowDesktop = TRUE;
|
||||
BOOLEAN g_BreakShowBackgroundFile = FALSE;
|
||||
BOOLEAN g_BreakBackgroundStretch = FALSE;
|
||||
TCHAR g_BreakBackgroundFile[MAX_PATH] = {0};
|
||||
BOOLEAN g_OptionsShown = FALSE;
|
||||
BOOLEAN g_ShowTrayIcon = TRUE;
|
||||
BOOLEAN g_SnapToGrid = TRUE;
|
||||
BOOLEAN g_TelescopeZoomOut = TRUE;
|
||||
BOOLEAN g_BreakOnSecondary = FALSE;
|
||||
LOGFONT g_LogFont;
|
||||
BOOLEAN g_DemoTypeUserDriven = false;
|
||||
TCHAR g_DemoTypeFile[MAX_PATH] = {0};
|
||||
DWORD g_DemoTypeSpeedSlider = static_cast<int>(((MIN_TYPING_SPEED - MAX_TYPING_SPEED) / 2) + MAX_TYPING_SPEED);
|
||||
DWORD g_RecordFrameRate = 30;
|
||||
// Divide by 100 to get actual scaling
|
||||
DWORD g_RecordScaling = 100;
|
||||
BOOLEAN g_CaptureAudio = FALSE;
|
||||
TCHAR g_MicrophoneDeviceId[MAX_PATH] = {0};
|
||||
|
||||
REG_SETTING RegSettings[] = {
|
||||
{ L"ToggleKey", SETTING_TYPE_DWORD, 0, &g_ToggleKey, static_cast<DOUBLE>(g_ToggleKey) },
|
||||
{ L"LiveZoomToggleKey", SETTING_TYPE_DWORD, 0, &g_LiveZoomToggleKey, static_cast<DOUBLE>(g_LiveZoomToggleKey) },
|
||||
{ L"DrawToggleKey", SETTING_TYPE_DWORD, 0, &g_DrawToggleKey, static_cast<DOUBLE>(g_DrawToggleKey) },
|
||||
{ L"RecordToggleKey", SETTING_TYPE_DWORD, 0, &g_RecordToggleKey, static_cast<DOUBLE>(g_RecordToggleKey) },
|
||||
{ L"SnipToggleKey", SETTING_TYPE_DWORD, 0, &g_SnipToggleKey, static_cast<DOUBLE>(g_SnipToggleKey) },
|
||||
{ L"PenColor", SETTING_TYPE_DWORD, 0, &g_PenColor, static_cast<DOUBLE>(g_PenColor) },
|
||||
{ L"PenWidth", SETTING_TYPE_DWORD, 0, &g_RootPenWidth, static_cast<DOUBLE>(g_RootPenWidth) },
|
||||
{ L"OptionsShown", SETTING_TYPE_BOOLEAN, 0, &g_OptionsShown, static_cast<DOUBLE>(g_OptionsShown) },
|
||||
{ L"BreakPenColor", SETTING_TYPE_DWORD, 0, &g_BreakPenColor, static_cast<DOUBLE>(g_BreakPenColor) },
|
||||
{ L"BreakTimerKey", SETTING_TYPE_DWORD, 0, &g_BreakToggleKey, static_cast<DOUBLE>(g_BreakToggleKey) },
|
||||
{ L"DemoTypeToggleKey", SETTING_TYPE_DWORD, 0, &g_DemoTypeToggleKey, static_cast<DOUBLE>(g_DemoTypeToggleKey) },
|
||||
{ L"DemoTypeFile", SETTING_TYPE_STRING, sizeof( g_DemoTypeFile ), g_DemoTypeFile, static_cast<DOUBLE>(0) },
|
||||
{ L"DemoTypeSpeedSlider", SETTING_TYPE_DWORD, 0, &g_DemoTypeSpeedSlider, static_cast<DOUBLE>(g_DemoTypeSpeedSlider) },
|
||||
{ L"DemoTypeUserDrivenMode", SETTING_TYPE_BOOLEAN, 0, &g_DemoTypeUserDriven, static_cast<DOUBLE>(g_DemoTypeUserDriven) },
|
||||
{ L"BreakTimeout", SETTING_TYPE_DWORD, 0, &g_BreakTimeout, static_cast<DOUBLE>(g_BreakTimeout) },
|
||||
{ L"BreakOpacity", SETTING_TYPE_DWORD, 0, &g_BreakOpacity, static_cast<DOUBLE>(g_BreakOpacity) },
|
||||
{ L"BreakPlaySoundFile", SETTING_TYPE_BOOLEAN, 0, &g_BreakPlaySoundFile, static_cast<DOUBLE>(0) },
|
||||
{ L"BreakSoundFile", SETTING_TYPE_STRING, sizeof(g_BreakSoundFile), g_BreakSoundFile, static_cast<DOUBLE>(0) },
|
||||
{ L"BreakShowBackgroundFile", SETTING_TYPE_BOOLEAN, 0, &g_BreakShowBackgroundFile, static_cast<DOUBLE>(g_BreakShowBackgroundFile) },
|
||||
{ L"BreakBackgroundStretch", SETTING_TYPE_BOOLEAN, 0, &g_BreakBackgroundStretch,static_cast<DOUBLE>(g_BreakBackgroundStretch) },
|
||||
{ L"BreakBackgroundFile", SETTING_TYPE_STRING, sizeof(g_BreakBackgroundFile), g_BreakBackgroundFile, static_cast<DOUBLE>(0) },
|
||||
{ L"BreakTimerPosition", SETTING_TYPE_DWORD, 0, &g_BreakTimerPosition, static_cast<DOUBLE>(g_BreakTimerPosition) },
|
||||
{ L"BreakShowDesktop", SETTING_TYPE_BOOLEAN, 0, &g_BreakShowDesktop, static_cast<DOUBLE>(g_BreakShowDesktop) },
|
||||
{ L"BreakOnSecondary", SETTING_TYPE_BOOLEAN, 0, &g_BreakOnSecondary,static_cast<DOUBLE>(g_BreakOnSecondary) },
|
||||
{ L"FontScale", SETTING_TYPE_DWORD, 0, &g_FontScale, static_cast<DOUBLE>(g_FontScale) },
|
||||
{ L"ShowExpiredTime", SETTING_TYPE_BOOLEAN, 0, &g_ShowExpiredTime, static_cast<DOUBLE>(g_ShowExpiredTime) },
|
||||
{ L"ShowTrayIcon", SETTING_TYPE_BOOLEAN, 0, &g_ShowTrayIcon, static_cast<DOUBLE>(g_ShowTrayIcon) },
|
||||
{ L"AnimnateZoom", SETTING_TYPE_BOOLEAN, 0, &g_AnimateZoom, static_cast<DOUBLE>(g_AnimateZoom) },
|
||||
{ L"TelescopeZoomOut", SETTING_TYPE_BOOLEAN, 0, &g_TelescopeZoomOut, static_cast<DOUBLE>(g_TelescopeZoomOut) },
|
||||
{ L"SnapToGrid", SETTING_TYPE_BOOLEAN, 0, &g_SnapToGrid, static_cast<DOUBLE>(g_SnapToGrid) },
|
||||
{ L"ZoominSliderLevel", SETTING_TYPE_DWORD, 0, &g_SliderZoomLevel, static_cast<DOUBLE>(g_SliderZoomLevel) },
|
||||
{ L"Font", SETTING_TYPE_BINARY, sizeof g_LogFont, &g_LogFont, static_cast<DOUBLE>(0) },
|
||||
{ L"RecordFrameRate", SETTING_TYPE_DWORD, 0, &g_RecordFrameRate, static_cast<DOUBLE>(g_RecordFrameRate) },
|
||||
{ L"RecordScaling", SETTING_TYPE_DWORD, 0, &g_RecordScaling, static_cast<DOUBLE>(g_RecordScaling) },
|
||||
{ L"CaptureAudio", SETTING_TYPE_BOOLEAN, 0, &g_CaptureAudio, static_cast<DOUBLE>(g_CaptureAudio) },
|
||||
{ L"MicrophoneDeviceId", SETTING_TYPE_STRING, sizeof(g_MicrophoneDeviceId), g_MicrophoneDeviceId, static_cast<DOUBLE>(0) },
|
||||
{ NULL, SETTING_TYPE_DWORD, 0, NULL, static_cast<DOUBLE>(0) }
|
||||
};
|
||||
7674
src/modules/ZoomIt/ZoomIt/Zoomit.cpp
Normal file
7674
src/modules/ZoomIt/ZoomIt/Zoomit.cpp
Normal file
File diff suppressed because it is too large
Load Diff
36
src/modules/ZoomIt/ZoomIt/Zoomit.exe.manifest
Normal file
36
src/modules/ZoomIt/ZoomIt/Zoomit.exe.manifest
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly
|
||||
xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||
manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
name="ZoomIt"
|
||||
version="1.0.0.0"
|
||||
type="win32"
|
||||
processorArchitecture="*"/>
|
||||
<description>Sysinternals Zoomit</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
type="win32"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<trustInfo>
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel
|
||||
level="asInvoker" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<application>
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">per monitor</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
BIN
src/modules/ZoomIt/ZoomIt/appicon.ico
Normal file
BIN
src/modules/ZoomIt/ZoomIt/appicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
18
src/modules/ZoomIt/ZoomIt/binres.rc
Normal file
18
src/modules/ZoomIt/ZoomIt/binres.rc
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// This file allows for CPU architecture dependencies
|
||||
|
||||
#ifdef _M_IX86
|
||||
|
||||
//
|
||||
// x86
|
||||
//
|
||||
|
||||
// To prevent Visual Studio dependency tracking logic from assuming that the x64 .res depend on the .exe that contain them, trick it with the macros
|
||||
// The .rc's included below will be touched every time any of the .exe's mentioned in them is rebuilt thus guaranteeing the Win32 .rc will be recompiled too
|
||||
#include "Dependency-x64.rc"
|
||||
|
||||
RCZOOMIT64 BINRES MOVEABLE PURE RCZOOMIT_x64_path
|
||||
|
||||
#endif
|
||||
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "ZoomIt.exe.manifest"
|
||||
BIN
src/modules/ZoomIt/ZoomIt/cursor1.cur
Normal file
BIN
src/modules/ZoomIt/ZoomIt/cursor1.cur
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 326 B |
BIN
src/modules/ZoomIt/ZoomIt/drawingc.cur
Normal file
BIN
src/modules/ZoomIt/ZoomIt/drawingc.cur
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 326 B |
BIN
src/modules/ZoomIt/ZoomIt/icon1.ico
Normal file
BIN
src/modules/ZoomIt/ZoomIt/icon1.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
58
src/modules/ZoomIt/ZoomIt/makefile
Normal file
58
src/modules/ZoomIt/ZoomIt/makefile
Normal file
@@ -0,0 +1,58 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on procmon.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=release
|
||||
!MESSAGE No configuration specified. Defaulting to procmon - Release.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "release" && "$(CFG)" != "debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE CFG="release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "release"
|
||||
!MESSAGE "debug"
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "release"
|
||||
|
||||
ALL : SUBMODULEUPDATE ZOOMITX64 ZOOMIT64A ZOOMIT32
|
||||
|
||||
ZOOMITX64:
|
||||
msbuild.exe -m ZoomIt.sln /p:Configuration=Release /p:Platform=x64
|
||||
|
||||
ZOOMIT64A:
|
||||
msbuild.exe -m ZoomIt.sln /p:Configuration=Release /p:Platform=ARM64
|
||||
|
||||
ZOOMIT32:
|
||||
msbuild.exe -m ZoomIt.sln /p:Configuration=Release /p:Platform=Win32
|
||||
|
||||
!ELSEIF "$(CFG)" == "debug"
|
||||
|
||||
ALL : SUBMODULEUPDATE ZOOMITX64 ZOOMIT64A ZOOMIT32
|
||||
|
||||
ZOOMITX64:
|
||||
msbuild.exe -m ZoomIt.sln /p:Configuration=Debug /p:Platform=x64
|
||||
|
||||
ZOOMIT64A:
|
||||
msbuild.exe -m ZoomIt.sln /p:Configuration=Debug /p:Platform=ARM64
|
||||
|
||||
ZOOMIT32:
|
||||
msbuild.exe -m ZoomIt.sln /p:Configuration=Debug /p:Platform=Win32
|
||||
|
||||
!ENDIF
|
||||
|
||||
SUBMODULEUPDATE:
|
||||
if not exist modules\Build\.git call modules\update.cmd
|
||||
6
src/modules/ZoomIt/ZoomIt/packages.config
Normal file
6
src/modules/ZoomIt/ZoomIt/packages.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231216.1" targetFramework="native" />
|
||||
<package id="robmikh.common" version="0.0.23-beta" targetFramework="native" />
|
||||
</packages>
|
||||
1
src/modules/ZoomIt/ZoomIt/pch.cpp
Normal file
1
src/modules/ZoomIt/ZoomIt/pch.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "pch.h"
|
||||
97
src/modules/ZoomIt/ZoomIt/pch.h
Normal file
97
src/modules/ZoomIt/ZoomIt/pch.h
Normal file
@@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include <WinUser.h>
|
||||
#include <shlobj.h>
|
||||
#include <tchar.h>
|
||||
#include <wincodec.h>
|
||||
#include <magnification.h>
|
||||
#include <Uxtheme.h>
|
||||
#include <math.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlwapi.h>
|
||||
#include <stdio.h>
|
||||
#include "Eula/eula.h"
|
||||
#include "registry.h"
|
||||
#include "resource.h"
|
||||
#include "dll.h"
|
||||
#define GDIPVER 0x0110
|
||||
#include <gdiplus.h>
|
||||
|
||||
// Must come before C++/WinRT
|
||||
#include <wil/cppwinrt.h>
|
||||
|
||||
#include <wincodec.h>
|
||||
|
||||
// WinRT
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.Foundation.Metadata.h>
|
||||
#include <winrt/Windows.Foundation.Numerics.h>
|
||||
#include <winrt/Windows.System.h>
|
||||
#include <winrt/Windows.UI.h>
|
||||
#include <winrt/Windows.UI.Composition.h>
|
||||
#include <winrt/Windows.UI.Composition.Desktop.h>
|
||||
#include <winrt/Windows.UI.Popups.h>
|
||||
#include <winrt/Windows.Graphics.Capture.h>
|
||||
#include <winrt/Windows.Graphics.Imaging.h>
|
||||
#include <winrt/Windows.Graphics.DirectX.h>
|
||||
#include <winrt/Windows.Graphics.DirectX.Direct3d11.h>
|
||||
#include <winrt/Windows.Media.h>
|
||||
#include <winrt/Windows.Media.Core.h>
|
||||
#include <winrt/Windows.Media.Transcoding.h>
|
||||
#include <winrt/Windows.Media.MediaProperties.h>
|
||||
#include <winrt/Windows.Media.Devices.h>
|
||||
#include <winrt/Windows.Storage.h>
|
||||
#include <winrt/Windows.Storage.Streams.h>
|
||||
#include <winrt/Windows.Storage.Pickers.h>
|
||||
#include <winrt/Windows.Devices.Enumeration.h>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
// Direct3D wrappers to avoid implicitly linking to d3d11.dll; must come before declaration
|
||||
#define CreateDirect3D11DeviceFromDXGIDevice WrapCreateDirect3D11DeviceFromDXGIDevice
|
||||
#define CreateDirect3D11SurfaceFromDXGISurface WrapCreateDirect3D11SurfaceFromDXGISurface
|
||||
#define D3D11CreateDevice WrapD3D11CreateDevice
|
||||
|
||||
#include "VideoRecordingSession.h"
|
||||
#include "SelectRectangle.h"
|
||||
#include "DemoType.h"
|
||||
#include "versionhelper.h"
|
||||
|
||||
// WIL
|
||||
#include <wil/com.h>
|
||||
#include <wil/resource.h>
|
||||
|
||||
// DirectX
|
||||
#include <d3d11_4.h>
|
||||
#include <dxgi1_6.h>
|
||||
#include <d2d1_3.h>
|
||||
|
||||
|
||||
// STL
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <future>
|
||||
#include <regex>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
// robmikh.common
|
||||
#include <robmikh.common/composition.interop.h>
|
||||
#include <robmikh.common/direct3d11.interop.h>
|
||||
#include <robmikh.common/d3d11Helpers.h>
|
||||
#include <robmikh.common/graphics.interop.h>
|
||||
#include <robmikh.common/dispatcherQueue.desktop.interop.h>
|
||||
#include <robmikh.common/d3d11Helpers.desktop.h>
|
||||
#include <robmikh.common/composition.desktop.interop.h>
|
||||
#include <robmikh.common/hwnd.interop.h>
|
||||
#include <robmikh.common/capture.desktop.interop.h>
|
||||
#include <robmikh.common/DesktopWindow.h>
|
||||
115
src/modules/ZoomIt/ZoomIt/resource.h
Normal file
115
src/modules/ZoomIt/ZoomIt/resource.h
Normal file
@@ -0,0 +1,115 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by ZoomIt.rc
|
||||
//
|
||||
//////////////////////////////
|
||||
// Non-localizable
|
||||
|
||||
#define FILE_DESCRIPTION "Sysinternals Screen Magnifier"
|
||||
#define INTERNAL_NAME "ZoomIt"
|
||||
#define ORIGINAL_FILENAME "PowerToys.ZoomIt.exe"
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
#define IDC_AUDIO 117
|
||||
#define IDC_LINK 1000
|
||||
#define IDC_ALT 1001
|
||||
#define IDC_CTRL 1002
|
||||
#define IDC_TOGGLE 1003
|
||||
#define IDC_OPTIONS 1004
|
||||
#define IDC_COLOR_PICK 1005
|
||||
#define IDC_COLOR 1006
|
||||
#define IDC_DRAW 1007
|
||||
#define IDC_TITLE 1008
|
||||
#define IDC_VERSION 1008
|
||||
#define IDC_ZOOM 1009
|
||||
#define IDC_DRAWING 1010
|
||||
#define IDC_BREAK 1011
|
||||
#define IDC_HOTKEY 1014
|
||||
#define IDC_DRAW_HOTKEY 1015
|
||||
#define IDC_HOTKEY2 1015
|
||||
#define IDC_LIVE_HOTKEY 1015
|
||||
#define IDC_BREAK_HOTKEY 1016
|
||||
#define IDC_SOUND_FILE 1017
|
||||
#define IDC_BACKGROUND_FILE 1018
|
||||
#define IDC_SPIN 1022
|
||||
#define IDC_SPIN_TIMER 1023
|
||||
#define IDC_SOUND_BROWSE 1025
|
||||
#define IDC_OPACITY 1026
|
||||
#define IDC_CHECK1 1027
|
||||
#define IDC_ADVANCED_BREAK 1027
|
||||
#define IDC_CHECK_SOUND_FILE 1027
|
||||
#define IDC_CHECK_BACKGROUND_FILE 1028
|
||||
#define IDC_BACKGROUND_BROWSE 1029
|
||||
#define IDC_TIMER_POS1 1030
|
||||
#define IDC_TIMER_POS2 1031
|
||||
#define IDC_TIMER_POS3 1032
|
||||
#define IDC_TIMER_POS4 1033
|
||||
#define IDC_TIMER_POS5 1034
|
||||
#define IDC_TIMER_POS6 1035
|
||||
#define IDC_TIMER_POS7 1036
|
||||
#define IDC_TIMER_POS8 1037
|
||||
#define IDC_TIMER_POS9 1038
|
||||
#define IDC_STATIC_SOUND_FILE 1039
|
||||
#define IDC_EDIT1 1040
|
||||
#define IDC_STATIC_BACKGROUND_FILE 1040
|
||||
#define IDC_TYPE 1041
|
||||
#define IDC_CHECK2 1042
|
||||
#define IDC_CHECK_SHOW_EXPIRED 1042
|
||||
#define IDC_TRAY_ICON 1042
|
||||
#define IDC_HIDE_TRAY_ICON 1042
|
||||
#define IDC_SHOW_TRAY_ICON 1042
|
||||
#define IDC_AUTOSTART 1043
|
||||
#define IDC_CHECK_BACKGROUND_STRETCH 1046
|
||||
#define IDC_STATIC_DESKTOP_BACKGROUND 1047
|
||||
#define IDC_STATIC_DESKTOP_BACKGROUND 1047
|
||||
#define IDC_TAB 1050
|
||||
#define IDC_FONT 1051
|
||||
#define IDC_ZOOM_SPIN_TIMER 1052
|
||||
#define IDC_ZOOM_SPIN 1052
|
||||
#define IDC_ZOOM_LEVEL 1053
|
||||
#define IDC_TEXT_FONT 1054
|
||||
#define IDC_ZOOM_SLIDER 1056
|
||||
#define IDC_ANIMATE_ZOOM 1057
|
||||
#define IDC_COMBO1 1058
|
||||
#define IDC_RECORD_FRAME_RATE 1058
|
||||
#define IDC_SPIN1 1059
|
||||
#define IDC_RECORD_FRAME_RATE2 1059
|
||||
#define IDC_RECORD_SCALING 1059
|
||||
#define IDC_SNIP_HOTKEY 1060
|
||||
#define IDC_CAPTURE_AUDIO 1061
|
||||
#define IDC_MICROPHONE 1062
|
||||
#define IDC_PEN_CONTROL 1063
|
||||
#define IDC_COLORS 1064
|
||||
#define IDC_HIGHLIGHT_AND_BLUR 1065
|
||||
#define IDC_SHAPES 1066
|
||||
#define IDC_SCREEN 1067
|
||||
#define IDC_DEMOTYPE_TEXT 1068
|
||||
#define IDC_DEMOTYPE_BROWSE 1069
|
||||
#define IDC_DEMOTYPE_FILE 1070
|
||||
#define IDC_DEMOTYPE_SPEED_SLIDER 1071
|
||||
#define IDC_DEMOTYPE_USER_DRIVEN 1072
|
||||
#define IDC_DEMOTYPE_STATIC1 1073
|
||||
#define IDC_DEMOTYPE_SLIDER2 1074
|
||||
#define IDC_DEMOTYPE_STATIC2 1074
|
||||
#define IDC_COPYRIGHT 1075
|
||||
#define IDC_PEN_WIDTH 1105
|
||||
#define IDC_TIMER 1106
|
||||
#define IDC_SAVE 40002
|
||||
#define IDC_COPY 40004
|
||||
#define IDC_RECORD 40006
|
||||
#define IDC_RECORD_HOTKEY 40007
|
||||
#define IDC_COPY_CROP 40008
|
||||
#define IDC_SAVE_CROP 40009
|
||||
#define IDC_DEMOTYPE_HOTKEY 40011
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 118
|
||||
#define _APS_NEXT_COMMAND_VALUE 40013
|
||||
#define _APS_NEXT_CONTROL_VALUE 1076
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../../../common/version/version.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#include "winres.h"
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION FILE_VERSION
|
||||
PRODUCTVERSION PRODUCT_VERSION
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
|
||||
BEGIN
|
||||
VALUE "CompanyName", COMPANY_NAME
|
||||
VALUE "FileDescription", FILE_DESCRIPTION
|
||||
VALUE "FileVersion", FILE_VERSION_STRING
|
||||
VALUE "InternalName", INTERNAL_NAME
|
||||
VALUE "LegalCopyright", COPYRIGHT_NOTE
|
||||
VALUE "OriginalFilename", ORIGINAL_FILENAME
|
||||
VALUE "ProductName", PRODUCT_NAME
|
||||
VALUE "ProductVersion", PRODUCT_VERSION_STRING
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{e4585179-2ac1-4d5f-a3ff-cfc5392f694c}</ProjectGuid>
|
||||
<RootNamespace>ZoomItModuleInterface</RootNamespace>
|
||||
<ProjectName>ZoomItModuleInterface</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<OutDir>..\..\..\..\$(Platform)\$(Configuration)\</OutDir>
|
||||
<TargetName>PowerToys.ZoomItModuleInterface</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;$(SolutionDir)src\common\Telemetry;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="trace.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ZoomItModuleInterface.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(UsePrecompiledHeaders)' != 'false'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="trace.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="trace.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ZoomItModuleInterface.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="trace.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
233
src/modules/ZoomIt/ZoomItModuleInterface/dllmain.cpp
Normal file
233
src/modules/ZoomIt/ZoomItModuleInterface/dllmain.cpp
Normal file
@@ -0,0 +1,233 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <modules/interface/powertoy_module_interface.h>
|
||||
#include <common/SettingsAPI/settings_objects.h>
|
||||
|
||||
#include "trace.h"
|
||||
#include <common/logger/logger.h>
|
||||
#include <common/utils/logger_helper.h>
|
||||
#include <common/utils/resources.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <common/interop/shared_constants.h>
|
||||
|
||||
namespace NonLocalizable
|
||||
{
|
||||
const wchar_t ModulePath[] = L"PowerToys.ZoomIt.exe";
|
||||
const inline wchar_t ModuleKey[] = L"ZoomIt";
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE /*hModule*/,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID /*lpReserved*/
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
Trace::RegisterProvider();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
Trace::UnregisterProvider();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
class ZoomItModuleInterface : public PowertoyModuleIface
|
||||
{
|
||||
public:
|
||||
// Return the localized display name of the powertoy
|
||||
virtual PCWSTR get_name() override
|
||||
{
|
||||
return app_name.c_str();
|
||||
}
|
||||
|
||||
// Return the non localized key of the powertoy, this will be cached by the runner
|
||||
virtual const wchar_t* get_key() override
|
||||
{
|
||||
return app_key.c_str();
|
||||
}
|
||||
|
||||
// Return the configured status for the gpo policy for the module
|
||||
virtual powertoys_gpo::gpo_rule_configured_t gpo_policy_enabled_configuration() override
|
||||
{
|
||||
return powertoys_gpo::getConfiguredZoomItEnabledValue();
|
||||
}
|
||||
|
||||
// Return JSON with the configuration options.
|
||||
// These are the settings shown on the settings page along with their current values.
|
||||
virtual bool get_config(wchar_t* buffer, int* buffer_size) override
|
||||
{
|
||||
HINSTANCE hinstance = reinterpret_cast<HINSTANCE>(&__ImageBase);
|
||||
|
||||
// TODO: Read settings from Registry.
|
||||
|
||||
// Create a Settings object.
|
||||
PowerToysSettings::Settings settings(hinstance, get_name());
|
||||
|
||||
return settings.serialize_to_buffer(buffer, buffer_size);
|
||||
}
|
||||
|
||||
// Passes JSON with the configuration settings for the powertoy.
|
||||
// This is called when the user hits Save on the settings page.
|
||||
virtual void set_config(const wchar_t*) override
|
||||
{
|
||||
try
|
||||
{
|
||||
// Parse the input JSON string.
|
||||
// TODO: Save settings to registry.
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
// Improper JSON.
|
||||
}
|
||||
}
|
||||
|
||||
// Enable the powertoy
|
||||
virtual void enable()
|
||||
{
|
||||
Logger::info("ZoomIt enabling");
|
||||
Enable();
|
||||
}
|
||||
|
||||
// Disable the powertoy
|
||||
virtual void disable()
|
||||
{
|
||||
Logger::info("ZoomIt disabling");
|
||||
Disable(true);
|
||||
}
|
||||
|
||||
// Returns if the powertoy is enabled
|
||||
virtual bool is_enabled() override
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
// Destroy the powertoy and free memory
|
||||
virtual void destroy() override
|
||||
{
|
||||
Disable(false);
|
||||
delete this;
|
||||
}
|
||||
|
||||
ZoomItModuleInterface()
|
||||
{
|
||||
app_name = L"ZoomIt";
|
||||
app_key = NonLocalizable::ModuleKey;
|
||||
LoggerHelpers::init_logger(app_key, L"ModuleInterface", LogSettings::zoomItLoggerName);
|
||||
m_reload_settings_event_handle = CreateDefaultEvent(CommonSharedConstants::ZOOMIT_REFRESH_SETTINGS_EVENT);
|
||||
m_exit_event_handle = CreateDefaultEvent(CommonSharedConstants::ZOOMIT_EXIT_EVENT);
|
||||
}
|
||||
|
||||
private:
|
||||
bool is_enabled_by_default() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Enable()
|
||||
{
|
||||
m_enabled = true;
|
||||
|
||||
// Log telemetry
|
||||
Trace::EnableZoomIt(true);
|
||||
|
||||
// Pass the PID.
|
||||
unsigned long powertoys_pid = GetCurrentProcessId();
|
||||
std::wstring executable_args = L"";
|
||||
executable_args.append(std::to_wstring(powertoys_pid));
|
||||
|
||||
ResetEvent(m_reload_settings_event_handle);
|
||||
ResetEvent(m_exit_event_handle);
|
||||
|
||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
|
||||
sei.lpFile = NonLocalizable::ModulePath;
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpParameters = executable_args.data();
|
||||
if (ShellExecuteExW(&sei) == false)
|
||||
{
|
||||
Logger::error(L"Failed to start zoomIt");
|
||||
auto message = get_last_error_message(GetLastError());
|
||||
if (message.has_value())
|
||||
{
|
||||
Logger::error(message.value());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hProcess = sei.hProcess;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Disable(bool const traceEvent)
|
||||
{
|
||||
m_enabled = false;
|
||||
|
||||
// Log telemetry
|
||||
if (traceEvent)
|
||||
{
|
||||
Trace::EnableZoomIt(false);
|
||||
}
|
||||
|
||||
// Tell the ZoomIt process to exit.
|
||||
SetEvent(m_exit_event_handle);
|
||||
|
||||
ResetEvent(m_reload_settings_event_handle);
|
||||
|
||||
// Wait for 1.5 seconds for the process to end correctly and stop etw tracer
|
||||
WaitForSingleObject(m_hProcess, 1500);
|
||||
|
||||
// If process is still running, terminate it
|
||||
if (m_hProcess)
|
||||
{
|
||||
TerminateProcess(m_hProcess, 0);
|
||||
m_hProcess = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool is_process_running()
|
||||
{
|
||||
return WaitForSingleObject(m_hProcess, 0) == WAIT_TIMEOUT;
|
||||
}
|
||||
|
||||
virtual void call_custom_action(const wchar_t* action) override
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerToysSettings::CustomActionObject action_object =
|
||||
PowerToysSettings::CustomActionObject::from_json_string(action);
|
||||
|
||||
if (action_object.get_name() == L"refresh_settings")
|
||||
{
|
||||
SetEvent(m_reload_settings_event_handle);
|
||||
}
|
||||
}
|
||||
catch (std::exception&)
|
||||
{
|
||||
Logger::error(L"Failed to parse action. {}", action);
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring app_name;
|
||||
std::wstring app_key; //contains the non localized key of the powertoy
|
||||
|
||||
bool m_enabled = false;
|
||||
HANDLE m_hProcess = nullptr;
|
||||
|
||||
HANDLE m_reload_settings_event_handle = NULL;
|
||||
HANDLE m_exit_event_handle = NULL;
|
||||
};
|
||||
|
||||
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()
|
||||
{
|
||||
return new ZoomItModuleInterface();
|
||||
}
|
||||
4
src/modules/ZoomIt/ZoomItModuleInterface/packages.config
Normal file
4
src/modules/ZoomIt/ZoomItModuleInterface/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
</packages>
|
||||
5
src/modules/ZoomIt/ZoomItModuleInterface/pch.cpp
Normal file
5
src/modules/ZoomIt/ZoomItModuleInterface/pch.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
||||
9
src/modules/ZoomIt/ZoomItModuleInterface/pch.h
Normal file
9
src/modules/ZoomIt/ZoomItModuleInterface/pch.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#include <windows.h>
|
||||
#include <Unknwn.h>
|
||||
#include <winrt/base.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <TraceLoggingActivity.h>
|
||||
13
src/modules/ZoomIt/ZoomItModuleInterface/resource.h
Normal file
13
src/modules/ZoomIt/ZoomItModuleInterface/resource.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by ZoomItModuleInterface.rc
|
||||
|
||||
//////////////////////////////
|
||||
// Non-localizable
|
||||
|
||||
#define FILE_DESCRIPTION "PowerToys ZoomItModuleInterface"
|
||||
#define INTERNAL_NAME "PowerToys.ZoomItModuleInterface"
|
||||
#define ORIGINAL_FILENAME "PowerToys.ZoomItModuleInterface.dll"
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
93
src/modules/ZoomIt/ZoomItModuleInterface/trace.cpp
Normal file
93
src/modules/ZoomIt/ZoomItModuleInterface/trace.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
#include "pch.h"
|
||||
#include "trace.h"
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
|
||||
TRACELOGGING_DEFINE_PROVIDER(
|
||||
g_hProvider,
|
||||
"Microsoft.PowerToys",
|
||||
// {38e8889b-9731-53f5-e901-e8a7c1753074}
|
||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||
TraceLoggingOptionProjectTelemetry());
|
||||
|
||||
// Log if the user has ZoomIt enabled or disabled
|
||||
void Trace::EnableZoomIt(const bool enabled) noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_EnableZoomIt",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||
TraceLoggingBoolean(enabled, "Enabled"));
|
||||
}
|
||||
|
||||
void Trace::ZoomItStarted() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_Started",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::ZoomItActivateBreak() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_ActivateBreak",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::ZoomItActivateDraw() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_ActivateDraw",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::ZoomItActivateZoom() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_ActivateZoom",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::ZoomItActivateLiveZoom() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_ActivateLiveZoom",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::ZoomItActivateDemoType() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_ActivateDemoType",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::ZoomItActivateRecord() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_ActivateRecord",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::ZoomItActivateSnip() noexcept
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"ZoomIt_ActivateSnip",
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
17
src/modules/ZoomIt/ZoomItModuleInterface/trace.h
Normal file
17
src/modules/ZoomIt/ZoomItModuleInterface/trace.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <common/Telemetry/TraceBase.h>
|
||||
class Trace : public telemetry::TraceBase
|
||||
{
|
||||
public:
|
||||
// Log if the user has ZoomIt enabled or disabled
|
||||
static void EnableZoomIt(const bool enabled) noexcept;
|
||||
static void ZoomItStarted() noexcept;
|
||||
static void ZoomItActivateBreak() noexcept;
|
||||
static void ZoomItActivateDraw() noexcept;
|
||||
static void ZoomItActivateZoom() noexcept;
|
||||
static void ZoomItActivateLiveZoom() noexcept;
|
||||
static void ZoomItActivateDemoType() noexcept;
|
||||
static void ZoomItActivateRecord() noexcept;
|
||||
static void ZoomItActivateSnip() noexcept;
|
||||
};
|
||||
16
src/modules/ZoomIt/ZoomItSettingsInterop/PropertySheet.props
Normal file
16
src/modules/ZoomIt/ZoomItSettingsInterop/PropertySheet.props
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<!--
|
||||
To customize common C++/WinRT project properties:
|
||||
* right-click the project node
|
||||
* expand the Common Properties item
|
||||
* select the C++/WinRT property page
|
||||
|
||||
For more advanced scenarios, and complete documentation, please see:
|
||||
https://github.com/Microsoft/cppwinrt/tree/master/nuget
|
||||
-->
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup />
|
||||
</Project>
|
||||
274
src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.cpp
Normal file
274
src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.cpp
Normal file
@@ -0,0 +1,274 @@
|
||||
#include "pch.h"
|
||||
#include "ZoomItSettings.h"
|
||||
#include "ZoomItSettings.g.cpp"
|
||||
#include "../ZoomIt/ZoomItSettings.h"
|
||||
#include <common/SettingsAPI/settings_objects.h>
|
||||
#include <common/utils/color.h>
|
||||
#include <map>
|
||||
#pragma comment(lib, "Crypt32.lib") // For the CryptStringToBinaryW and CryptBinaryToStringW functions
|
||||
|
||||
namespace winrt::PowerToys::ZoomItSettingsInterop::implementation
|
||||
{
|
||||
ClassRegistry reg(_T("Software\\Sysinternals\\") APPNAME);
|
||||
|
||||
const unsigned int SPECIAL_SEMANTICS_SHORTCUT = 1;
|
||||
const unsigned int SPECIAL_SEMANTICS_COLOR = 2;
|
||||
const unsigned int SPECIAL_SEMANTICS_LOG_FONT = 3;
|
||||
|
||||
std::vector<unsigned char> base64_decode(const std::wstring& base64_string)
|
||||
{
|
||||
DWORD binary_len = 0;
|
||||
// Get the required buffer size for the binary data
|
||||
if (!CryptStringToBinaryW(base64_string.c_str(), 0, CRYPT_STRING_BASE64, nullptr, &binary_len, nullptr, nullptr))
|
||||
{
|
||||
throw std::runtime_error("Error in CryptStringToBinaryW (getting size)");
|
||||
}
|
||||
|
||||
std::vector<unsigned char> binary_data(binary_len);
|
||||
|
||||
// Decode the Base64 string into binary data
|
||||
if (!CryptStringToBinaryW(base64_string.c_str(), 0, CRYPT_STRING_BASE64, binary_data.data(), &binary_len, nullptr, nullptr))
|
||||
{
|
||||
throw std::runtime_error("Error in CryptStringToBinaryW (decoding)");
|
||||
}
|
||||
|
||||
return binary_data;
|
||||
}
|
||||
|
||||
std::wstring base64_encode(const unsigned char* data, size_t length)
|
||||
{
|
||||
DWORD base64_len = 0;
|
||||
// Get the required buffer size for Base64 string
|
||||
if (!CryptBinaryToStringW(data, static_cast<DWORD>(length), CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, nullptr, &base64_len))
|
||||
{
|
||||
throw std::runtime_error("Error in CryptBinaryToStringW (getting size)");
|
||||
}
|
||||
|
||||
std::wstring base64_string(base64_len, '\0');
|
||||
|
||||
// Encode the binary data to Base64
|
||||
if (!CryptBinaryToStringW(data, static_cast<DWORD>(length), CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, &base64_string[0], &base64_len))
|
||||
{
|
||||
throw std::runtime_error("Error in CryptBinaryToStringW (encoding)");
|
||||
}
|
||||
|
||||
// Resize the wstring to remove any trailing null character.
|
||||
if (!base64_string.empty() && base64_string.back() == L'\0')
|
||||
{
|
||||
base64_string.pop_back();
|
||||
}
|
||||
|
||||
return base64_string;
|
||||
}
|
||||
|
||||
std::map<std::wstring, unsigned int> settings_with_special_semantics = {
|
||||
{ L"ToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
|
||||
{ L"LiveZoomToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
|
||||
{ L"DrawToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
|
||||
{ L"RecordToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
|
||||
{ L"SnipToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
|
||||
{ L"BreakTimerKey", SPECIAL_SEMANTICS_SHORTCUT },
|
||||
{ L"DemoTypeToggleKey", SPECIAL_SEMANTICS_SHORTCUT },
|
||||
{ L"PenColor", SPECIAL_SEMANTICS_COLOR },
|
||||
{ L"BreakPenColor", SPECIAL_SEMANTICS_COLOR },
|
||||
{ L"Font", SPECIAL_SEMANTICS_LOG_FONT },
|
||||
};
|
||||
|
||||
hstring ZoomItSettings::LoadSettingsJson()
|
||||
{
|
||||
PowerToysSettings::PowerToyValues _settings(L"ZoomIt",L"ZoomIt");
|
||||
reg.ReadRegSettings(RegSettings);
|
||||
PREG_SETTING curSetting = RegSettings;
|
||||
while (curSetting->ValueName)
|
||||
{
|
||||
switch (curSetting->Type)
|
||||
{
|
||||
case SETTING_TYPE_DWORD:
|
||||
{
|
||||
auto special_semantics = settings_with_special_semantics.find(curSetting->ValueName);
|
||||
DWORD value = *static_cast<PDWORD>(curSetting->Setting);
|
||||
if (special_semantics == settings_with_special_semantics.end())
|
||||
{
|
||||
_settings.add_property<DWORD>(curSetting->ValueName, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (special_semantics->second == SPECIAL_SEMANTICS_SHORTCUT)
|
||||
{
|
||||
auto hotkey = PowerToysSettings::HotkeyObject::from_settings(
|
||||
value & (HOTKEYF_EXT << 8), //WIN
|
||||
value & (HOTKEYF_CONTROL << 8),
|
||||
value & (HOTKEYF_ALT << 8),
|
||||
value & (HOTKEYF_SHIFT << 8),
|
||||
value & 0xFF);
|
||||
_settings.add_property(curSetting->ValueName, hotkey.get_json());
|
||||
}
|
||||
else if (special_semantics->second == SPECIAL_SEMANTICS_COLOR)
|
||||
{
|
||||
// PowerToys settings likes colors as #FFFFFF strings.
|
||||
hstring s = winrt::to_hstring(std::format("#{:02x}{:02x}{:02x}", value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF));
|
||||
_settings.add_property(curSetting->ValueName, s);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SETTING_TYPE_BOOLEAN:
|
||||
_settings.add_property<bool>(curSetting->ValueName, *static_cast<PBOOLEAN>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_DOUBLE:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_WORD:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_STRING:
|
||||
_settings.add_property<std::wstring>(curSetting->ValueName, static_cast<PTCHAR>(curSetting->Setting));
|
||||
break;
|
||||
case SETTING_TYPE_DWORD_ARRAY:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_WORD_ARRAY:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_BINARY:
|
||||
auto special_semantics = settings_with_special_semantics.find(curSetting->ValueName);
|
||||
if (special_semantics != settings_with_special_semantics.end() && special_semantics->second == SPECIAL_SEMANTICS_LOG_FONT)
|
||||
{
|
||||
// This is the font setting. It's a special case where the default value needs to be calculated if it's still 0.
|
||||
if (g_LogFont.lfFaceName[0] == L'\0')
|
||||
{
|
||||
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof g_LogFont, &g_LogFont);
|
||||
g_LogFont.lfWeight = FW_NORMAL;
|
||||
auto hDc = CreateCompatibleDC(NULL);
|
||||
g_LogFont.lfHeight = -MulDiv(8, GetDeviceCaps(hDc, LOGPIXELSY), 72);
|
||||
DeleteDC(hDc);
|
||||
}
|
||||
}
|
||||
|
||||
// Base64 encoding is likely the best way to serialize a byte array into JSON.
|
||||
auto encodedFont = base64_encode(static_cast<PBYTE>(curSetting->Setting), curSetting->Size);
|
||||
_settings.add_property<std::wstring>(curSetting->ValueName, encodedFont);
|
||||
break;
|
||||
}
|
||||
curSetting++;
|
||||
}
|
||||
|
||||
return _settings.get_raw_json().Stringify();
|
||||
}
|
||||
|
||||
void ZoomItSettings::SaveSettingsJson(hstring json)
|
||||
{
|
||||
reg.ReadRegSettings(RegSettings);
|
||||
|
||||
// Parse the input JSON string.
|
||||
PowerToysSettings::PowerToyValues valuesFromSettings =
|
||||
PowerToysSettings::PowerToyValues::from_json_string(json, L"ZoomIt");
|
||||
|
||||
PREG_SETTING curSetting = RegSettings;
|
||||
while (curSetting->ValueName)
|
||||
{
|
||||
switch (curSetting->Type)
|
||||
{
|
||||
case SETTING_TYPE_DWORD:
|
||||
{
|
||||
auto special_semantics = settings_with_special_semantics.find(curSetting->ValueName);
|
||||
if (special_semantics == settings_with_special_semantics.end())
|
||||
{
|
||||
auto possibleValue = valuesFromSettings.get_uint_value(curSetting->ValueName);
|
||||
if (possibleValue.has_value())
|
||||
{
|
||||
*static_cast<PDWORD>(curSetting->Setting) = possibleValue.value();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (special_semantics->second == SPECIAL_SEMANTICS_SHORTCUT)
|
||||
{
|
||||
auto possibleValue = valuesFromSettings.get_json(curSetting->ValueName);
|
||||
if (possibleValue.has_value())
|
||||
{
|
||||
auto hotkey = PowerToysSettings::HotkeyObject::from_json(possibleValue.value());
|
||||
unsigned int value = 0;
|
||||
value |= hotkey.get_code();
|
||||
if (hotkey.ctrl_pressed())
|
||||
{
|
||||
value |= (HOTKEYF_CONTROL << 8);
|
||||
}
|
||||
if (hotkey.alt_pressed())
|
||||
{
|
||||
value |= (HOTKEYF_ALT << 8);
|
||||
}
|
||||
if (hotkey.shift_pressed())
|
||||
{
|
||||
value |= (HOTKEYF_SHIFT << 8);
|
||||
}
|
||||
if (hotkey.win_pressed())
|
||||
{
|
||||
value |= (HOTKEYF_EXT << 8);
|
||||
}
|
||||
*static_cast<PDWORD>(curSetting->Setting) = value;
|
||||
}
|
||||
}
|
||||
else if (special_semantics->second == SPECIAL_SEMANTICS_COLOR)
|
||||
{
|
||||
auto possibleValue = valuesFromSettings.get_string_value(curSetting->ValueName);
|
||||
if (possibleValue.has_value())
|
||||
{
|
||||
uint8_t r, g, b;
|
||||
if (checkValidRGB(possibleValue.value(), &r, &g, &b))
|
||||
{
|
||||
*static_cast<PDWORD>(curSetting->Setting) = RGB(r, g, b);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SETTING_TYPE_BOOLEAN:
|
||||
{
|
||||
auto possibleValue = valuesFromSettings.get_bool_value(curSetting->ValueName);
|
||||
if (possibleValue.has_value())
|
||||
{
|
||||
*static_cast<PBOOLEAN>(curSetting->Setting) = static_cast<BOOLEAN>(possibleValue.value());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SETTING_TYPE_DOUBLE:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_WORD:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_STRING:
|
||||
{
|
||||
auto possibleValue = valuesFromSettings.get_string_value(curSetting->ValueName);
|
||||
if (possibleValue.has_value())
|
||||
{
|
||||
const TCHAR* value = possibleValue.value().c_str();
|
||||
_tcscpy_s(static_cast<PTCHAR>(curSetting->Setting), curSetting->Size / sizeof(TCHAR), value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SETTING_TYPE_DWORD_ARRAY:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_WORD_ARRAY:
|
||||
assert(false); // ZoomIt doesn't use this type of setting.
|
||||
break;
|
||||
case SETTING_TYPE_BINARY:
|
||||
auto possibleValue = valuesFromSettings.get_string_value(curSetting->ValueName);
|
||||
if (possibleValue.has_value())
|
||||
{
|
||||
// Base64 encoding is likely the best way to serialize a byte array into JSON.
|
||||
auto decodedValue = base64_decode(possibleValue.value());
|
||||
assert(curSetting->Size == decodedValue.size()); // Should right now only be used for LOGFONT, so let's hard check it to avoid any insecure overflows.
|
||||
memcpy(static_cast<PBYTE>(curSetting->Setting), decodedValue.data(), decodedValue.size());
|
||||
}
|
||||
break;
|
||||
}
|
||||
curSetting++;
|
||||
}
|
||||
reg.WriteRegSettings(RegSettings);
|
||||
}
|
||||
}
|
||||
20
src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.h
Normal file
20
src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "ZoomItSettings.g.h"
|
||||
|
||||
namespace winrt::PowerToys::ZoomItSettingsInterop::implementation
|
||||
{
|
||||
struct ZoomItSettings : ZoomItSettingsT<ZoomItSettings>
|
||||
{
|
||||
ZoomItSettings() = default;
|
||||
static hstring LoadSettingsJson();
|
||||
static void SaveSettingsJson(hstring json);
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::PowerToys::ZoomItSettingsInterop::factory_implementation
|
||||
{
|
||||
struct ZoomItSettings : ZoomItSettingsT<ZoomItSettings, implementation::ZoomItSettings>
|
||||
{
|
||||
};
|
||||
}
|
||||
10
src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.idl
Normal file
10
src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.idl
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace PowerToys
|
||||
{
|
||||
namespace ZoomItSettingsInterop
|
||||
{
|
||||
[default_interface] static runtimeclass ZoomItSettings {
|
||||
static String LoadSettingsJson();
|
||||
static void SaveSettingsJson(String json);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
EXPORTS
|
||||
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
|
||||
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <windows.h>
|
||||
#include "resource.h"
|
||||
#include "../../../common/version/version.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#include "winres.h"
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION FILE_VERSION
|
||||
PRODUCTVERSION PRODUCT_VERSION
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
|
||||
BEGIN
|
||||
VALUE "CompanyName", COMPANY_NAME
|
||||
VALUE "FileDescription", FILE_DESCRIPTION
|
||||
VALUE "FileVersion", FILE_VERSION_STRING
|
||||
VALUE "InternalName", INTERNAL_NAME
|
||||
VALUE "LegalCopyright", COPYRIGHT_NOTE
|
||||
VALUE "OriginalFilename", ORIGINAL_FILENAME
|
||||
VALUE "ProductName", PRODUCT_NAME
|
||||
VALUE "ProductVersion", PRODUCT_VERSION_STRING
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
|
||||
<MinimalCoreWin>true</MinimalCoreWin>
|
||||
<ProjectGuid>{ca7d8106-30B9-4aec-9d05-b69b31b8c461}</ProjectGuid>
|
||||
<ProjectName>ZoomItSettingsInterop</ProjectName>
|
||||
<RootNamespace>PowerToys.ZoomItSettingsInterop</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>false</AppContainerApplication>
|
||||
<AppxPackage>false</AppxPackage>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="PropertySheet.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<TargetName>PowerToys.ZoomItSettingsInterop</TargetName>
|
||||
<OutDir>..\..\..\..\$(Platform)\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_WINRT_DLL;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
<ModuleDefinitionFile>ZoomItSettingsInterop.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>Shell32.lib;gdi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="ZoomItSettings.h">
|
||||
<DependentUpon>ZoomItSettings.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ZoomItSettings.cpp">
|
||||
<DependentUpon>ZoomItSettings.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="ZoomItSettings.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="ZoomItSettingsInterop.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ZoomItSettingsInterop.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resources">
|
||||
<UniqueIdentifier>{de682ddf-17ab-471d-9761-82b42e6baa70}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Generated Files">
|
||||
<UniqueIdentifier>{c02d42a3-682e-499a-8b28-638a0802d43f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="ZoomItSettings.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ZoomItSettingsInterop.def" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PropertySheet.props" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ZoomItSettingsInterop.rc">
|
||||
<Filter>Resources</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
5
src/modules/ZoomIt/ZoomItSettingsInterop/packages.config
Normal file
5
src/modules/ZoomIt/ZoomItSettingsInterop/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231216.1" targetFramework="native" />
|
||||
</packages>
|
||||
1
src/modules/ZoomIt/ZoomItSettingsInterop/pch.cpp
Normal file
1
src/modules/ZoomIt/ZoomItSettingsInterop/pch.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "pch.h"
|
||||
22
src/modules/ZoomIt/ZoomItSettingsInterop/pch.h
Normal file
22
src/modules/ZoomIt/ZoomItSettingsInterop/pch.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <tchar.h>
|
||||
#include <magnification.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#define GDIPVER 0x0110
|
||||
#include <gdiplus.h>
|
||||
// DirectX
|
||||
#include <d3d11_4.h>
|
||||
#include <dxgi1_6.h>
|
||||
#include <d2d1_3.h>
|
||||
|
||||
// Must come before C++/WinRT
|
||||
#include <wil/cppwinrt.h>
|
||||
|
||||
#include <unknwn.h>
|
||||
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
13
src/modules/ZoomIt/ZoomItSettingsInterop/resource.h
Normal file
13
src/modules/ZoomIt/ZoomItSettingsInterop/resource.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by ZoomItSettingsInterop.rc
|
||||
|
||||
//////////////////////////////
|
||||
// Non-localizable
|
||||
|
||||
#define FILE_DESCRIPTION "PowerToys ZoomItSettingsInterop"
|
||||
#define INTERNAL_NAME "PowerToys.ZoomItSettingsInterop"
|
||||
#define ORIGINAL_FILENAME "PowerToys.ZoomItSettingsInterop.dll"
|
||||
|
||||
// Non-localizable
|
||||
//////////////////////////////
|
||||
Reference in New Issue
Block a user