発生
openFileDialog1->ShowDialog();
を実施すると、ダイアログが開かずアプリケーションがフリーズしました。
原因
エントリーポイントの関数に
[STAThreadAttribute]
指定が無いと、フリーズするみたいでした。
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
int main(array<System::String ^> ^args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);Application::Run(gcnew MyApplication::MainForm());
return 0;
}
参考
STAThreadAttribute クラス (System) | Microsoft Docs
STAThreadの意味は? - .NET Tips (VB.NET,C#...)
開発環境
- Windows10 Pro
- Microsoft Visual Studio Community 2019 Version 16.9.5