|
-
Mar 31st, 2024, 12:51 PM
#1
Thread Starter
Fanatic Member
Enhancing a VB6 App with Interactive Particle Effects Using RichClient6 & WebView2
I am programming a full screen VB6 app that should include visual effects like particles at touch down / up / click or gestures.
I want to use JS + css and render the particle effect.
https://codepen.io/andysanchez-dev/pen/oaOyvK
Essentially, I want the particles to show up not just within the WebView2 control but across the entire screen, including over the VB6 form.
Is it possible to have these effects run in WebView2 with CSS and JavaScript, and then render them onto a transparent window in VB6?
The goal is to keep the app as a VB6 executable (.exe) while incorporating these modern visual effects. I'm considering a setup where I create a transparent, layered window (using WS_EX_LAYERED and WS_EX_TRANSPARENT, set to HWND_TOPMOST) to achieve this.
Has anyone successfully integrated such effects into a VB6 application? If so, could you share insights or examples on making JS/CSS animations from WebView2 appear on a transparent VB6 window?
Could I advise WebView2 to render onto a Cairo surface and render this Cairo surface onto the transparent form?
Thank you for any advice or guidance you can provide!
To clarify, I am well-versed in creating and managing topmost transparent windows, so I don’t need assistance with that aspect. My query specifically concerns integrating JS/CSS animations from WebView2 onto a transparent VB6 window, and whether it's feasible to instruct WebView2 to render onto a Cairo surface, which could then be displayed on the transparent form.
Code:
Private Sub pCreateAndShowTopMostTransparentLayeredWindow(uX As Long, ByVal uY As Long)
Debug.Assert m_Hdc <> 0
Dim ptSrc As POINTAPI
Dim ptSize As POINTAPI
Dim ptDest As POINTAPI
ptSrc.x = 0
ptSrc.Y = 0
ptSize.x = m_lIntendedWidth
ptSize.Y = m_lIntendedHeight
ptDest.x = uX 'Position where our window should be shown on the screen
ptDest.Y = uY
m_funcBlend32bpp.AlphaFormat = AC_SRC_ALPHA
m_funcBlend32bpp.BlendFlags = 0
m_funcBlend32bpp.BlendOp = AC_SRC_OVER
m_funcBlend32bpp.SourceConstantAlpha = 155 'For debugging I want to see the actual size of my window still
'UpdateLayeredWindow resizes the window, resulting in vbform width (=300 pixels in my case) multiplied by screen.twipsperpoixely=4500 pixel!
UpdateLayeredWindow Me.hwnd, m_Hdc, ptDest, ptSize, m_Hdc, ptSrc, 0, m_funcBlend32bpp, LWA_ALPHA
Debug.Assert Me.Width = ptSize.x'Make sure this window is still our intended size
Debug.Assert Me.Width = m_lIntendedWidth
Debug.Assert Me.Height = m_lIntendedHeight
Dim lRet&
lRet = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
SetWindowLong Me.hwnd, GWL_EXSTYLE, lRet Or WS_EX_LAYERED Or WS_EX_TRANSPARENT 'This does NOT show the window yet!
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOACTIVATE 'This does NOT show the window yet!
'This finally shows the windows
ShowWindow Me.hwnd, SW_SHOWNOACTIVATE
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|