Nice aren't they?
Anyone any clue how to do this in VB6?
Specifically the glass like effects and the fade in and fade out
Complete source-code would be appreciated, but the names of the effects would, I suppose, suffice.
Cheers chaps
Printable View
Nice aren't they?
Anyone any clue how to do this in VB6?
Specifically the glass like effects and the fade in and fade out
Complete source-code would be appreciated, but the names of the effects would, I suppose, suffice.
Cheers chaps
if you're looking for modifying a windows transparency/translucency then have a look at the examples in the codebank.
the API in question is SetLayeredWindowAttributes - but unfortunately it's too long to search for and a wild-card search doesn't bring up any hits from the codebank :confused:
Anyway - are they the sort of effects you're looking for?
SetLayeredWindowAttributes is usually accompanied by GetWindowLong / SetWindowLong / WS_EX_TRANSPARENT/ WS_EX_LAYERED / LWA_COLORKEY / GWL_EXSTYLE. You'll get some false +ves in search, but there it is....
Here's what I came up with.
VB Code:
Option Explicit Private mAlpha As Long Private mFade As FADE Private Sub Form_Load() ' Set window style to layered ' SetWindowLongW Me.hWnd, GWL_EXSTYLE, GetWindowLongW(Me.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED AlphaBlend.Interval = 30 AlphaBlend.Enabled = True mAlpha = -20 mFade = FadeIn End Sub Private Sub Form_Unload(Cancel As Integer) If mAlpha > 0 Then Cancel = True End If End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If mAlpha > 0 Then AlphaBlend.Enabled = True mFade = FadeOut Else Unload Me End If End Sub Private Sub AlphaBlend_Timer() If mFade = FadeIn Then mAlpha = mAlpha + 20 If mAlpha > 255 Then AlphaBlend.Enabled = False SetLayeredWindowAttributes Me.hWnd, 0, 255, LWA_ALPHA Else SetLayeredWindowAttributes Me.hWnd, 0, mAlpha, LWA_ALPHA End If Else mAlpha = mAlpha - 20 If mAlpha < 0 Then AlphaBlend.Enabled = False SetLayeredWindowAttributes Me.hWnd, 0, 0, LWA_ALPHA mAlpha = -1 Unload Me Else SetLayeredWindowAttributes Me.hWnd, 0, mAlpha, LWA_ALPHA End If End If End Sub
with these winapi's:
VB Code:
'************************** '* Win32 Constants . . . '************************** Public Const LWA_ALPHA As Long = &H2 Public Const GWL_EXSTYLE As Long = (-20) Public Const WS_EX_LAYERED = &H80000 '******************************** '* Win32 API declarations . . . '******************************** Public Declare Function GetWindowLongW Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Public Declare Function SetWindowLongW Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long