microsoft / microsoft/WindowsAppSDK-Samples

how to register WindowsApp runtime classes?

Open
#294 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1k
Forks
335
Avg merge
5d 1h
Merged PRs (30d)
8

Description

I have following code, it's the short version of the sample squares, it compiled, but failed with 80040154(REGDB_E_CLASSNOTREG) which means the runtime classes of WindowsApp is not registered. I've installed WindowsAppSDK 1.3 from this link. It seems that the installer did not register it. So, my question is how to register it manually?

#include <winrt/base.h>
#include <winrt/Microsoft.UI.Windowing.h>
#include <winrt/Microsoft.UI.Dispatching.h>
#include <windows.h>
#pragma comment(lib, "windowsapp")

using namespace winrt;
using namespace Microsoft::UI::Windowing;
using namespace Microsoft::UI::Dispatching;
/*
cl /nologo /EHsc /Zi /std:c++latest /Iapiexp/winui3 winui3.cpp /link /subsystem:console /debug
*/
int WinMain(HINSTANCE,HINSTANCE,PSTR,int) {
  winrt::init_apartment(winrt::apartment_type::single_threaded);
  try {
    auto appWindow = AppWindow::Create();
    appWindow.Title(L"Squares");
    appWindow.Show();

    auto ctl = DispatcherQueueController::CreateOnCurrentThread();
    auto queue = ctl.DispatcherQueue();
    queue.RunEventLoop();
  } catch(hresult_error e) {
    printf("winui3 0x%x\n",int32_t(e.code()));
  }
}

int main() {
  return WinMain(nullptr,nullptr,nullptr,0);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the minimal C++ program shown in the issue after installing Windows App SDK 1.3 from the linked installer, and confirm where 80040154 occurs. Start by checking the runtime-class deployment and registration requirements for this installation method. Done means documenting the supported registration or deployment steps, or clarifying that the installer is not sufficient for this scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.