1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* IPCWindow.h
* -----------
* Purpose: Hidden window to receive file open commands from another OpenMPT instance
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
OPENMPT_NAMESPACE_BEGIN
namespace IPCWindow
{
enum class Function : ULONG
{
Open = 0x01,
SetWindowForeground = 0x02,
GetVersion = 0x03, // returns Version::GewRawVersion()
GetArchitecture = 0x04, // returns mpt::OS::Windows::Architecture
HasSameBinaryPath = 0x05,
HasSameSettingsPath = 0x06
};
void Open(HINSTANCE hInstance);
void Close();
LRESULT SendIPC(HWND ipcWnd, Function function, mpt::const_byte_span data = mpt::const_byte_span());
template <typename Tdata> LRESULT SendIPC(HWND ipcWnd, Function function, mpt::span<const Tdata> data) { return SendIPC(ipcWnd, function, mpt::const_byte_span(reinterpret_cast<const std::byte*>(data.data()), data.size() * sizeof(Tdata))); }
enum InstanceRequirements
{
SamePath = 0x01u,
SameSettings = 0x02u,
SameArchitecture = 0x04u,
SameVersion = 0x08u
};
MPT_DECLARE_ENUM(InstanceRequirements)
HWND FindIPCWindow();
HWND FindIPCWindow(FlagSet<InstanceRequirements> require);
// Send file open requests to other OpenMPT instance, if there is one
bool SendToIPC(const std::vector<mpt::PathString> &filenames);
}
OPENMPT_NAMESPACE_END
|