Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QWindowsContext: OleInitialize() failed: "COM error ... #17

Open
zzstuzor opened this issue Jun 27, 2019 · 1 comment
Open

QWindowsContext: OleInitialize() failed: "COM error ... #17

zzstuzor opened this issue Jun 27, 2019 · 1 comment

Comments

@zzstuzor
Copy link

Hello,

Every time I run the example project, or any project, I get a console window appear displaying the following error:

QWindowsContext: OleInitialize() failed: "COM error 0xffffffff80010106 RPC_E_CHANGED_MODE (Unknown error 0x080010106)"

The program continues and seems to work fine... but any idea why is this happening?

Thanks!

@kshanafelt
Copy link

I had the same problem, and solved it by added [STAThread] to Main(string[] args)
Here is some example code:

  [STAThread]
  public static int Main(string[] args)
  {
    RuntimeManager.DiscoverOrDownloadSuitableQtRuntime();
            
    using (var app = new QGuiApplication())
    using (var engine = new QQmlApplicationEngine()) {
      var results = QmlRegistry.RegisterType<SomeType>();

      engine.Load("main.qml");
      return app.Exec();
    }
  }

While not a direct answer to this problem, these stackoverflow answers helped me solve this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants