Results 1 to 4 of 4

Thread: Resolved: Vista effects

  1. #1

    Thread Starter
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Resolved 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

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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?

  3. #3
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    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....

  4. #4

    Thread Starter
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Re: Vista effects

    Here's what I came up with.

    VB Code:
    1. Option Explicit
    2.  
    3. Private mAlpha As Long
    4. Private mFade As FADE
    5.  
    6. Private Sub Form_Load()
    7.    
    8.     ' Set window style to layered
    9.     '
    10.     SetWindowLongW Me.hWnd, GWL_EXSTYLE, GetWindowLongW(Me.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
    11.     AlphaBlend.Interval = 30
    12.     AlphaBlend.Enabled = True
    13.     mAlpha = -20
    14.     mFade = FadeIn
    15.    
    16. End Sub
    17.  
    18. Private Sub Form_Unload(Cancel As Integer)
    19.     If mAlpha > 0 Then
    20.         Cancel = True
    21.     End If
    22. End Sub
    23.  
    24. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    25.    
    26.     If mAlpha > 0 Then
    27.         AlphaBlend.Enabled = True
    28.         mFade = FadeOut
    29.     Else
    30.         Unload Me
    31.     End If
    32.    
    33. End Sub
    34.  
    35. Private Sub AlphaBlend_Timer()
    36.  
    37.     If mFade = FadeIn Then
    38.         mAlpha = mAlpha + 20
    39.         If mAlpha > 255 Then
    40.             AlphaBlend.Enabled = False
    41.             SetLayeredWindowAttributes Me.hWnd, 0, 255, LWA_ALPHA
    42.         Else
    43.             SetLayeredWindowAttributes Me.hWnd, 0, mAlpha, LWA_ALPHA
    44.         End If
    45.     Else
    46.         mAlpha = mAlpha - 20
    47.         If mAlpha < 0 Then
    48.             AlphaBlend.Enabled = False
    49.             SetLayeredWindowAttributes Me.hWnd, 0, 0, LWA_ALPHA
    50.             mAlpha = -1
    51.             Unload Me
    52.         Else
    53.             SetLayeredWindowAttributes Me.hWnd, 0, mAlpha, LWA_ALPHA
    54.         End If
    55.     End If
    56.    
    57. End Sub

    with these winapi's:

    VB Code:
    1. '**************************
    2. '* Win32 Constants . . .
    3. '**************************
    4. Public Const LWA_ALPHA As Long = &H2
    5. Public Const GWL_EXSTYLE As Long = (-20)
    6. Public Const WS_EX_LAYERED = &H80000
    7.  
    8. '********************************
    9. '* Win32 API declarations  . . .
    10. '********************************
    11. Public Declare Function GetWindowLongW Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    12. Public Declare Function SetWindowLongW Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    13. 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
  •  



Click Here to Expand Forum to Full Width