Quickest way to implement a C++ Win32 Splash Screen

后端 未结 2 505
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 19:54

What\'s a simple way to implement a c++ Win32 program to...
- display an 800x600x24 uncompressed bitmap image
- in a window without borders (the only thing visible i

相关标签:
2条回答
  • 2021-02-14 20:03

    If you're targeting modern versions of Windows (Windows 2000) and above, you can use the UpdateLayeredWindow function to display any bitmap (including one with an alpha channel, if so desired).

    I blogged a four-part series on how to write a C++ Win32 app that does this. If you need to wait for exactly ten seconds to close the splash screen (instead of until the main window is ready), you would need to use Dan Cristoloveanu's suggested technique of a timer that calls DestroyWindow.

    0 讨论(0)
  • 2021-02-14 20:22

    You can:

    • Create a dialog in your resource file
    • Have it contain a Picture control
    • Set the picture control type to Bitmap
    • Create/import your bitmap in the resource file and set that bitmap ID to the picture control in your dialog
    • Create the window by using CreateDialogParam
    • Handle the WM_INITDIALOG in order to set a timer for 10 seconds (use SetTimer)
    • Handle WM_TIMER to catch your timer event and to destroy the window (use DestroyWindow)
    0 讨论(0)
提交回复
热议问题