Skip to content

Commit c98e011

Browse files
Working on default positioning (not working yet)
1 parent 143d6cd commit c98e011

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ShortDev.Uwp.FullTrust/ShortDev.Uwp.FullTrust/Activation/CoreWindowActivator.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public enum WindowType : int
1818
NOT_IMMERSIVE
1919
}
2020

21+
public const int CW_USEDEFAULT = (unchecked((int)0x80000000));
22+
2123
[DllImport("windows.ui.dll", EntryPoint = "#1500")]
2224
static extern int PrivateCreateCoreWindow(
2325
WindowType windowType,
@@ -32,10 +34,10 @@ static extern int PrivateCreateCoreWindow(
3234
out ICoreWindowInterop windowRef
3335
);
3436

35-
public static CoreWindow CreateCoreWindow(WindowType windowType, string windowTitle, IntPtr hOwnerWindow, int x = 0, int y = 0, uint width = 10, uint height = 10, uint dwAttributes = 0)
37+
public static CoreWindow CreateCoreWindow(WindowType windowType, string windowTitle, IntPtr hOwnerWindow, int x = CW_USEDEFAULT, int y = CW_USEDEFAULT, int width = CW_USEDEFAULT, int height = CW_USEDEFAULT, uint dwAttributes = 0)
3638
{
3739
Guid iid = typeof(ICoreWindowInterop).GUID;
38-
Marshal.ThrowExceptionForHR(PrivateCreateCoreWindow(windowType, windowTitle, x, y, width, height, dwAttributes, ref hOwnerWindow, ref iid, out ICoreWindowInterop windowRef));
40+
Marshal.ThrowExceptionForHR(PrivateCreateCoreWindow(windowType, windowTitle, x, y, (uint)width, (uint)height, dwAttributes, ref hOwnerWindow, ref iid, out ICoreWindowInterop windowRef));
3941
return (windowRef as object as CoreWindow)!;
4042
}
4143
}

0 commit comments

Comments
 (0)