dcsimg
Results 1 to 7 of 7

Thread: [VB6] Transparent AVI Animation

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,998

    [VB6] Transparent AVI Animation

    The Animation Control has a BackStyle setting of cc2BackstyleTransparent but this merely makes it take on its BackColor setting instead of using the AVI's backdrop.

    Windows 8 and later allow layered child windows, so we can work around that for full transparency and even some translucency if desired.

    This requires a manifest marking the EXE as Win8-aware or later, so in most cases you won't see this in IDE runs. You can get around that by applying such an awareness manifest to VB6.exe as well though.

    The Animation Control normally loads an AVI from a file, but by sending messages to its hWnd we can also make it load AVIs from embedded resources. This only works in the compiled EXE.


    For this demo I used a utility to convert an animated GIF to a compatible AVI.

    Name:  sshot.png
Views: 338
Size:  2.3 KB

    In the demo clicking "Play" makes the control visible and begins playing it, as well as slowly bouncing it left and right within the Form.
    Attached Files Attached Files

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,998

    Re: [VB6] Transparent AVI Animation

    Yes, more cute than useful for most programs. Another stunt.

  3. #3
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    332

    Re: [VB6] Transparent AVI Animation

    a bit like a circular progress bar

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,998

    Re: [VB6] Transparent AVI Animation

    Well the Spin.avi was just another example like the ones that come with VB6 for use with the Animation Control:

    BLUR16.AVI
    BLUR24.AVI
    BLUR8.AVI
    CINEAPK.AVI
    COUNT16.AVI
    COUNT24.AVI
    COUNT8.AVI
    COUNT8R.AVI
    download (1).avi
    DOWNLOAD.AVI
    DRILLRLE.AVI
    FILECOPY.AVI
    FILEDEL.AVI
    FILEDELR.AVI
    FILEMOVE.AVI
    FILENUKE.AVI
    FINDCOMP.AVI
    FINDFILE.AVI
    SEARCH.AVI

    The differences here are:

    • Transparent background.
    • Global translucency.
    • Load from embedded resource instead of a file.


    Those differences come from the code I wrote for using the Animation Control, not anything special about Spin.avi itself.

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,200

    Re: [VB6] Transparent AVI Animation

    Is there a way to get transparency on Win7?

    Other programs do similar, so it would seem there's gotta be some method...

    Edit: I tried a couple adjustments to the SetLayeredWindowAttributes call that people said work on 7, but didn't work for me.. e.g. white bkg/just LWA_ALPHA

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,998

    Re: [VB6] Transparent AVI Animation

    Perhaps by manual drawing, but I can't think of anything as simple as this.

    Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.

  7. #7
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,321

    Re: [VB6] Transparent AVI Animation

    FYI, WS_EX_LAYERED windows don't get WM_PAINT msgs i.e. the OS does not invalidate and redraw on demand any part of it.

    One has to manually update the "picture" (incl. the alpha channel) with calls to UpdateLayeredWindow which is not that bad a proposition at all.

    cheers,
    </wqw>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width