Files
PowerToys/src/common/interop/two_way_pipe_message_ipc.h
Jaime Bernardo fb5ed13386 [Refactor]Port C++/CX to C++/WinRT (#34198)
## Summary of the Pull Request
Removes all C++/CX code, replacing it with C++/WinRT.

## Detailed Description of the Pull Request / Additional comments
Removes all C++/CX code.
Renames interop namespaces to be better consumed by CsWinRT.
Standardizes all projects on net8.0-windows10.0.20348.0, which is a
requirement for C++/WinRT usage.
FileLocksmithLibInterop brought to stdcpplatest and static analysis
errors were corrected.
Removed now unneeded string conversion code from
FileLocksmithLibInterop.
Changed interop KeyboardHook to use a single hook across all instances.
Required because on C++/WinRT we don't have the .NET runtime to bind a
object instance to a delegate and be able to pass it to a C function
pointer argument (still no idea why this worked correctly on C++/CX to
be honest). This change actually makes us create less low level keyboard
hooks.
Changed some code that depended on arrays since WinRT/C++ returns null
instead of an empty array through the interface.

## Validation Steps Performed
Built and tested runtime.
2024-08-08 15:26:43 +01:00

19 lines
492 B
C++

#pragma once
#include <functional>
class TwoWayPipeMessageIPC
{
public:
typedef std::function<void(const std::wstring&)>callback_function;
TwoWayPipeMessageIPC(
std::wstring _input_pipe_name,
std::wstring _output_pipe_name,
callback_function p_func);
~TwoWayPipeMessageIPC();
void send(std::wstring msg);
void start(HANDLE _restricted_pipe_token);
void end();
private:
class TwoWayPipeMessageIPCImpl;
TwoWayPipeMessageIPCImpl* impl;
};