在启动屏幕之前执行代码

发布于 2024-09-30 07:47:25 字数 252 浏览 0 评论 0原文

我有一个 VB.NET 应用程序,选中了启用应用程序框架,并设置了启动屏幕。同时,我需要在加载启动屏幕之前运行一些代码。 MyApplication_Startup 好像去得比较晚,所以不适合。我知道可以使用自定义启动屏幕,但更喜欢任何其他方式来实现它,而无需更复杂的自定义。

编辑:显然,问题是不同的。在启动屏幕之前运行的代码是特定于线程的。它没有产生适当的效果,因为启动屏幕位于另一个线程上。

I have a VB.NET application with Enable application framework checked, and Splash screen set. At the same time, I need to run some code before the splash screen is loaded. MyApplication_Startup seems to go later, so it's not suitable. I understand it's possible with custom splash screen, but would prefer any other way to make it without more complex customization.

EDIT: Apparently, the issue is different. Code that runs before the splash-screen is thread-specific. It doesn't take proper effect, since splash screen is on another thread.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泡沫很甜 2024-10-07 07:47:25

在项目属性下,单击查看应用程序事件。然后阅读评论:'以下事件可用于 MyApplication:
'
' 启动:在创建启动表单之前,应用程序启动时引发。
' 关闭:在所有申请表关闭后引发。如果应用程序异常终止,则不会引发此事件。
' UnhandledException:如果应用程序遇到未处理的异常,则引发该异常。
' StartupNextInstance:启动单实例应用程序且该应用程序已处于活动状态时引发。
' NetworkAvailabilityChanged:当网络连接连接或断开时引发。

不知道oyu有没有经历过这个。

Under project properties click View Application Events. Then read the comment: ' The following events are available for MyApplication:
'
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.

I don't know if oyu have been through this yet.

乱了心跳 2024-10-07 07:47:25

您是否使用 F8 键单步执行过代码?在显示启动屏幕之前,调试器可以向您显示可以在何处添加代码。

Have you stepped through your code using the F8 key? The debugger can show you where you can add code before your splash screen is shown.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文