-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
149 lines (133 loc) · 4.29 KB
/
Program.cs
File metadata and controls
149 lines (133 loc) · 4.29 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using Mile.Xaml;
using System;
using System.Runtime.InteropServices;
namespace MileXamlBlankAppNetFrameworkNativeBackend
{
public static class Program
{
[Flags]
enum WS_EX : uint
{
None = 0,
DLGMODALFRAME = 0x00000001,
NOPARENTNOTIFY = 0x00000004,
TOPMOST = 0x00000008,
ACCEPTFILES = 0x00000010,
TRANSPARENT = 0x00000020,
MDICHILD = 0x00000040,
TOOLWINDOW = 0x00000080,
WINDOWEDGE = 0x00000100,
CLIENTEDGE = 0x00000200,
CONTEXTHELP = 0x00000400,
RIGHT = 0x00001000,
LEFT = 0x00000000,
RTLREADING = 0x00002000,
LTRREADING = 0x00000000,
LEFTSCROLLBAR = 0x00004000,
RIGHTSCROLLBAR = 0x00000000,
CONTROLPARENT = 0x00010000,
STATICEDGE = 0x00020000,
APPWINDOW = 0x00040000,
LAYERED = 0x00080000,
NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
LAYOUTRTL = 0x00400000, // Right to left mirroring
COMPOSITED = 0x02000000,
NOACTIVATE = 0x08000000,
OVERLAPPEDWINDOW = (WINDOWEDGE | CLIENTEDGE),
PALETTEWINDOW = (WINDOWEDGE | TOOLWINDOW | TOPMOST),
}
[Flags]
enum WS : uint
{
OVERLAPPED = 0x00000000,
POPUP = 0x80000000,
CHILD = 0x40000000,
MINIMIZE = 0x20000000,
VISIBLE = 0x10000000,
DISABLED = 0x08000000,
CLIPSIBLINGS = 0x04000000,
CLIPCHILDREN = 0x02000000,
MAXIMIZE = 0x01000000,
BORDER = 0x00800000,
DLGFRAME = 0x00400000,
VSCROLL = 0x00200000,
HSCROLL = 0x00100000,
SYSMENU = 0x00080000,
THICKFRAME = 0x00040000,
GROUP = 0x00020000,
TABSTOP = 0x00010000,
MINIMIZEBOX = 0x00020000,
MAXIMIZEBOX = 0x00010000,
CAPTION = BORDER | DLGFRAME,
TILED = OVERLAPPED,
ICONIC = MINIMIZE,
SIZEBOX = THICKFRAME,
TILEDWINDOW = OVERLAPPEDWINDOW,
OVERLAPPEDWINDOW = OVERLAPPED | CAPTION | SYSMENU | THICKFRAME | MINIMIZEBOX | MAXIMIZEBOX,
POPUPWINDOW = POPUP | BORDER | SYSMENU,
CHILDWINDOW = CHILD,
}
public const int CW_USEDEFAULT = (unchecked((int)0x80000000));
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
static extern IntPtr CreateWindowEx(
WS_EX dwExStyle,
string lpClassName,
string lpWindowName,
WS dwStyle,
int X,
int Y,
int nWidth,
int nHeight,
IntPtr hWndParent,
IntPtr hMenu,
IntPtr hInstance,
IntPtr lpParam);
[DllImport("user32.dll")]
static extern bool UpdateWindow(
IntPtr hWnd);
enum SW
{
HIDE = 0,
SHOWNORMAL = 1,
NORMAL = 1,
SHOWMINIMIZED = 2,
SHOWMAXIMIZED = 3,
MAXIMIZE = 3,
SHOWNOACTIVATE = 4,
SHOW = 5,
MINIMIZE = 6,
SHOWMINNOACTIVE = 7,
SHOWNA = 8,
RESTORE = 9,
SHOWDEFAULT = 10,
FORCEMINIMIZE = 11,
}
[DllImport("user32.dll")]
static extern bool ShowWindow(
IntPtr hWnd,
SW nCmdShow);
[STAThread]
private static void Main()
{
App app = new();
MainPage Content = new MainPage();
IntPtr WindowHandle = CreateWindowEx(
WS_EX.CLIENTEDGE,
"Mile.Xaml.ContentWindow",
"MileXamlBlankApp (.Net Framework)",
WS.OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero,
Marshal.GetIUnknownForObject(Content));
ShowWindow(WindowHandle, SW.SHOW);
UpdateWindow(WindowHandle);
NativeWrapper.MileXamlContentWindowDefaultMessageLoop();
app.Close();
}
}
}