Failed to create a window when launching it throug

2019-08-29 01:54发布

Im trying to launch a dialog by invoking several methods from a windows forms assembly. My app is a console app. All the execution logic goes well and without exceptions, but the window is not launched. Is it a known issue that you cant launch a windows form from a console app?

1条回答
SAY GOODBYE
2楼-- · 2019-08-29 02:31

well, yes. You have to have a Windows message loop for this to work. If you create a Forms application from scratch, you'll see the Program.cs module created with ... Application.Run(new YourMainForm()) in it. Run is basically the message pump - having that is pretty much a requirement for forms to work.

查看更多
登录 后发表回答