|
-
Jul 11th, 2006, 12:54 PM
#1
Thread Starter
Frenzied Member
Resolved: Vista effects
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
Last edited by yrwyddfa; Jul 12th, 2006 at 08:22 AM.
Reason: Complete
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Jul 11th, 2006, 01:40 PM
#2
Re: Vista effects
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 
Anyway - are they the sort of effects you're looking for?
-
Jul 11th, 2006, 02:24 PM
#3
Re: Vista effects
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....
-
Jul 12th, 2006, 08:22 AM
#4
Thread Starter
Frenzied Member
Re: Vista effects
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
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
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
|