Replies: 24 comments
-
What ? CoreWindow is based on HWND, not the other way round. If you want SplashScreen support for WinUI 3 propose it and same goes for Win + Shift + Enter full screen. (yes, not all UI framework need splash screen and Win + Shift + Enter) Dup of #1573 , microsoft/microsoft-ui-xaml#4055
|
Beta Was this translation helpful? Give feedback.
-
What we want actually is the UX of CoreWindow(e.g immediate response of app launching with a splash screen). Due to the terrible startup speed of WinUI3, displaying a SplashScreen is only possible after a few seconds while the window is actually displayed, and not immediately after the user clicked on the app icon in the start menu to start the app. The former behavior hurts the user experience and may cause multiple attempts to start the app, which results in multiple instances of the app created and an even worse performance due to many instances eating up system resources. |
Beta Was this translation helpful? Give feedback.
-
Immediate response of CoreWindow are drawn by the OS itself. Add your proposals here on this official Splash Screen API discussion thread : #500
terrible startup speed ? Where did you get this information from ? if 3-5 seconds of delay is considered terrible, then by that definition all WPF apps from 2006 to this date are also terrible and "hurts user experience" too. |
Beta Was this translation helpful? Give feedback.
-
Compared to UWP CoreWindow application which gives immediate response and a blank app loads in less than a second in production environment. |
Beta Was this translation helpful? Give feedback.
-
So is it really THAT hard to bring CoreWindow model to WinUI3 in desktop as a option for developers? |
Beta Was this translation helpful? Give feedback.
-
except when you do NOT deliver an actual blank app in a real production environment.
whole point of AppWindow is to sugercoat the underlying win32 APIs as less as possible and give you unmanaged access to those underlying APIs contrary to managed CoreWindow. When AppWindow will not suffice, Use underlying APIs to create "Instant Window" for custom loading splash screen. Before having another assumption or two, learn win32 programming first. It won't take much longer to understand why CoreWindow is unnecessary for anything including cases like this. Readymade libraries WinUIEx provided by dotMorten maybe allows that functionality. |
Beta Was this translation helpful? Give feedback.
-
There's an undocumented function to associate an existing HWND to a new CoreWindow instance and you'll be able to use GetForCurrentView after calling it however you don't get a splash screen since that's created by the system even before your app starts. Under UWP, the initial window is created automatically which isn't how desktop apps work. |
Beta Was this translation helpful? Give feedback.
-
What's the function? |
Beta Was this translation helpful? Give feedback.
-
@ahmed605 knows about it. |
Beta Was this translation helpful? Give feedback.
-
PrivateCreateCoreWindow(WINDOW_TYPE, const wchar_t* title, int x, int y, int width, int height, int attributes, HWND owner, const IID& guid, void** ppv); enum WINDOW_TYPE
{
IMMERSIVE_BODY,
IMMERSIVE_DOCK,
IMMERSIVE_HOSTED,
IMMERSIVE_TEST,
IMMERSIVE_BODY_ACTIVE,
IMMERSIVE_DOCK_ACTIVE,
NOT_IMMERSIVE
};
HMODULE uiCore = LoadLibrary(L"Windows.UI.dll");
auto privateCreateCoreWindow = (PrivateCreateCoreWindow)GetProcAddress(uiCore, MAKEINTRESOURCEA(1500)); ComPtr<CoreWindow> coreWindow;
...
if (coreWindow == nullptr)
{
GUID iid;
IIDFromString(L"{79B9D5F2-879E-4B89-B798-79E47598030C}", &iid);
privateCreateCoreWindow(NOT_IMMERSIVE, L"Title", 0, 0, 1, 1, 0, window, iid, (void**)coreWindow.GetAddressOf());
} Credits to @ADeltaX not sure if it would work in WinUI 3 Desktop/WASDK or not tho |
Beta Was this translation helpful? Give feedback.
-
Thanks! Will try out in my project |
Beta Was this translation helpful? Give feedback.
-
Any example to do it in C#? |
Beta Was this translation helpful? Give feedback.
-
I don't recommend doing so in C# (.NET 5+) because CsWinRT types mostly won't be understood by the function (that's why the built-in WinRT interop was always better) but you can try... private enum WINDOW_TYPE
{
IMMERSIVE_BODY,
IMMERSIVE_DOCK,
IMMERSIVE_HOSTED,
IMMERSIVE_TEST,
IMMERSIVE_BODY_ACTIVE,
IMMERSIVE_DOCK_ACTIVE,
NOT_IMMERSIVE
}
[DllImport("Windows.UI.dll", CharSet=CharSet.None, EntryPoint="#1500", ExactSpelling=false, SetLastError=true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern int PrivateCreateCoreWindow(WINDOW_TYPE WindowType, string pWindowTitle, int X, int Y, uint uWidth, uint uHeight, int dwAttributes, IntPtr hOwnerWindow, Guid riid, out object ppv);
public static ICoreWindow CreateCoreWindow(string coreWindowTitle, IntPtr ownerHwnd)
{
object obj;
PrivateCreateCoreWindow(WINDOW_TYPE.NOT_IMMERSIVE, coreWindowTitle, 0, 0, 1, 1, 0, ownerHwnd, new Guid("79B9D5F2-879E-4B89-B798-79E47598030C"), out obj);
return (ICoreWindow)obj;
} |
Beta Was this translation helpful? Give feedback.
-
We got an AccessViolationException. |
Beta Was this translation helpful? Give feedback.
-
I guess WinUI 3/WASDK doesn't allow it then, it works in normal Win32 apps |
Beta Was this translation helpful? Give feedback.
-
I tried the function provided by @ahmed605 but sadly, it doesn't works. |
Beta Was this translation helpful? Give feedback.
-
Ok, I'm hearing three asks in this thread so far: Splash Screen support - currently Windows handles putting up a splash screen during app activation for UWPs. With the move to Desktop Apps, you want a way to get the same "show a Window while the rest of the runtime is loading" behavior. Seems like something the AppLifecycle group (@andreww-msft) could look into, under #1573 CoreWindow.PointerCursor - like https://docs.microsoft.com/uwp/api/windows.ui.core.corewindow.pointercursor?view=winrt-22000 ? Or are there other needs? Maybe @feisu or @rkarman could route. Fullscreen presenter - Definitely something @rkarman can look at. Handling a key combination to initiate fullscreen presentation mode would be a Really Great Sample. |
Beta Was this translation helpful? Give feedback.
-
Yes. In conclusion, all we need was a CoreWindow instance, or alternative apis for the same behaviors. |
Beta Was this translation helpful? Give feedback.
-
This really needs to be done. These new WinUI 3 apps with a disconnected Splash screens are insufferable. |
Beta Was this translation helpful? Give feedback.
-
Totally agree with you, looking forward for splash screen support for WinUI 3 Like UWP splash screen |
Beta Was this translation helpful? Give feedback.
-
Instead of using the window handle returned by PrivateCreateCoreWindow, you can use CoreWindow.GetForCurrentThread() to get a CoreWindow instance |
Beta Was this translation helpful? Give feedback.
-
This is how I achieve this internal static class PrivatePInvoke
{
private enum WINDOW_TYPE : uint
{
IMMERSIVE_BODY,
IMMERSIVE_DOCK,
IMMERSIVE_HOSTED,
IMMERSIVE_TEST,
IMMERSIVE_BODY_ACTIVE,
IMMERSIVE_DOCK_ACTIVE,
NOT_IMMERSIVE
}
[DllImport("Windows.UI.dll", CharSet = CharSet.None, EntryPoint = "#1500", ExactSpelling = false, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
private static extern HRESULT CreateCoreWindow(WINDOW_TYPE WindowType, PWSTR pWindowTitle, int x, int y, uint uWidth, uint uHeight, uint dwAttributes, HWND hOwnerWindow, Guid riid, out nint ppv);
public static unsafe CoreWindow CreateCoreWindow(string title, HWND hOwnerWindow)
{
fixed(char* pTitle = title)
{
CreateCoreWindow(WINDOW_TYPE.NOT_IMMERSIVE, pTitle, 0, 0, 1, 1, 0, hOwnerWindow, typeof(ICoreWindow).GUID, out nint thisPtr);
return CoreWindow.FromAbi(thisPtr);
}
}
} |
Beta Was this translation helpful? Give feedback.
-
This looks pretty good. But there is still a problem with the Windows App SDK, when the CoreWindow is created, the application uses the SystemBackdrop property to fail, and does not show any system backdrop, do you know how to solve this problem? |
Beta Was this translation helpful? Give feedback.
-
I create the CoreWindow before WinUI window ever |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Discussed in #1990
Originally posted by EP012014 January 15, 2022
Because desktop apps in Windows App SDK only supports the legacy HWND window model instead of the modern CoreWindow model, many features related to CoreWindow(e.g SplashScreen before window content actually loaded, Win+Shift+Enter for full screen) are missing.
So is it possible to bring back CoreWindow in WinUI3 desktop apps?
Beta Was this translation helpful? Give feedback.
All reactions