Skip to content

Using win32 to show the splash screen #2031

Open

Description

@lindexi

The advantage is that


Thanks @weltkante the WPF uses win32 method to show the splash screen and my title is not all right. But the code need many WPF feature. And I suggest that we can use all win32 methods to create a splash screen that means that this code can run in a console project.

Activity

  1. weltkante commented on Oct 10, 2019

    @weltkante

    WPF is already using plain win32 to show the splash screen (i.e. the splash screen is not a WPF window).

    The performance difference you see must come from somewhere else.

  2. lindexi commented on Oct 10, 2019

    @lindexi
    MemberAuthor
  3. weltkante commented on Oct 10, 2019

    @weltkante

    But not at all

    I don't see the difference, both the WPF code and your linked example use CreateWindow API to create a native window. They then use different native APIs for showing the image, but that shouldn't make much of a difference, if anything the WPF code using plain GDI should be faster than your sample which first needs to load the GDI+ library. The performance difference must be coming from somewhere else than creating and showing the window.

    In fact, if you look at the WPF source I linked and scroll up the resource lookup says it can be pretty slow (200-300ms) so I suspect the fact that WPF wants to localize the splash screen is what makes up for the performance difference.

    Maybe adding support for other sources of splash screen images (like you requested) will fix the performance difference. I don't think the window logic itself needs to be changed, just the image lookup.

    In either case your issue title is not accurate, WPF already uses win32 API to show the splash screen, what you are asking about is to make it faster and more flexible ...

  4. lindexi commented on Oct 10, 2019

    @lindexi
    MemberAuthor

    In either case your issue title is not accurate, WPF already uses win32 API to show the splash screen, what you are asking about is to make it faster and more flexible

    @weltkante Yes, I updated my summary but I do not find a good title.

  5. kkwpsv commented on Oct 10, 2019

    @kkwpsv

    But not at all

    I don't see the difference, both the WPF code and your linked example use CreateWindow API to create a native window. They then use different native APIs for showing the image, but that shouldn't make much of a difference, if anything the WPF code using plain GDI should be faster than your sample which first needs to load the GDI+ library. The performance difference must be coming from somewhere else than creating and showing the window.

    In fact, if you look at the WPF source I linked and scroll up the resource lookup says it can be pretty slow (200-300ms) so I suspect the fact that WPF wants to localize the splash screen is what makes up for the performance difference.

    Maybe adding support for other sources of splash screen images (like you requested) will fix the performance difference. I don't think the window logic itself needs to be changed, just the image lookup.

    In either case your issue title is not accurate, WPF already uses win32 API to show the splash screen, what you are asking about is to make it faster and more flexible ...

    @weltkante @lindexi GDI+ is used for gif transparent image. And from the code i can see that WPF use WIC to load Image. May this cause performance difference?

  6. weltkante commented on Oct 10, 2019

    @weltkante

    Yes loading WIC costs time, but its a native component (no JIT) so probably comparable to loading GDI+ in the other example. Considering the comment I linked already says resource loading slows down by 200-300ms, and OP is saying WPF is ~200ms slower than the other example, there is very little ambiguity where it comes from (assuming the comment isn't outdated). Any further speculation doesn't make much sense without doing actual profiling or measurements.

  7. mikedn commented on Oct 10, 2019

    @mikedn

    so probably comparable to loading GDI+

    And GDI+ uses WIC internally so by using GDI+ you'll probably end up loading both and wasting more time.

  8. kkwpsv commented on Oct 10, 2019

    @kkwpsv

    Yes, maybe we should do profiling to get the real reason.

    But now splash image in WPF has a noticeable delay before it is displayed. While in the example we can see the splash image immediately. We have a bad experience with delay, and want to see it immediately. This is the main purpose for this issuses.

  9. added
    Bug
    Performance
    on Oct 16, 2019
  10. added this to the Future milestone on Oct 16, 2019
  11. removed
    Bug
    on Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Performance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions