When using Win32 API, it's not really necessary to have a winmain entry point in order to create a window, because we can still call
CreateWindowExW, etc. I wonder if it's possible to do so as well in creating a C++/WinRT window, since almost every example on the Internet is using template projects.
I tried to create a struct which inherits
implements<App, IFrameworkView, IFrameworkViewSource> with all necessary functions (Initialize, Uninitialize, Load, SetWindow, Run, etc.), then call
int main(), but WinRT either complains about not having run
init_apartment() beforehand, or shows a weird error as
WinRT originate error - 0x80070057 : 'serverName' and that
E_INVALIDARG, and that a
hresult_invalid_argument(take_ownership_from_abi) is thrown. Plus, the source file created with template project doesn't even have to run
init_apartment() first, which I couldn't really understand why.
Is it possible to create a C++/WinRT window from a console application? Thanks.
User contributions licensed under CC BY-SA 3.0