Plasma Engine  2.0
Loading...
Searching...
No Matches
IncludeWindows.h
1#pragma once
2
3#include <Foundation/Basics.h>
4
5#define PL_INCLUDED_WINDOWS_H 1
6
7#if PL_ENABLED(PL_PLATFORM_WINDOWS)
8// this is important for code that wants to include winsock2.h later on
9# define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
10
11// already includes Windows.h, but defines important other things first
12// #include <winsock2.h>
13
14# ifndef WIN32_LEAN_AND_MEAN
15# define WIN32_LEAN_AND_MEAN
16# endif
17# include <Windows.h>
18
19// unset windows macros
20# undef min
21# undef max
22# undef GetObject
23# undef ERROR
24# undef DeleteFile
25# undef CopyFile
26# undef DispatchMessage
27# undef PostMessage
28# undef SendMessage
29# undef OPAQUE
30# undef SetPort
31
32# include <Foundation/Basics/Platform/Win/MinWindows.h>
33
34namespace plMinWindows
35{
36 template <>
37 struct ToNativeImpl<HINSTANCE>
38 {
39 using type = ::HINSTANCE;
40 static PL_ALWAYS_INLINE ::HINSTANCE ToNative(HINSTANCE hInstance) { return reinterpret_cast<::HINSTANCE>(hInstance); }
41 };
42
43 template <>
44 struct ToNativeImpl<HWND>
45 {
46 using type = ::HWND;
47 static PL_ALWAYS_INLINE ::HWND ToNative(HWND hWnd) { return reinterpret_cast<::HWND>(hWnd); }
48 };
49
50 template <>
51 struct FromNativeImpl<::HWND>
52 {
53 using type = HWND;
54 static PL_ALWAYS_INLINE HWND FromNative(::HWND hWnd) { return reinterpret_cast<HWND>(hWnd); }
55 };
56
57 template <>
58 struct FromNativeImpl<::HINSTANCE>
59 {
60 using type = HINSTANCE;
61 static PL_ALWAYS_INLINE HINSTANCE FromNative(::HINSTANCE hInstance) { return reinterpret_cast<HINSTANCE>(hInstance); }
62 };
63} // namespace plMinWindows
64#endif