Results 1 to 2 of 2

Thread: Code colouring test

  1. #1

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Code colouring test

    Code:
    Public Sub FadeIn(ByVal hwnd As Long, _
                      ByVal lngAlphaMax As Long, _
                      Optional ByVal lngStep As Long = 1)
        Dim udtOSVer            As OSVERSIONINFO
        Dim bAlpha              As Byte
        Dim lngWindowStyle      As Long
        
        udtOSVer.dwOSVersionInfoSize = Len(udtOSVer)
        
        GetVersionEx udtOSVer
        
        If udtOSVer.dwMajorVersion >= 5 Then
        
            bAlpha = 1
                
            lngWindowStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
            SetWindowLong hwnd, GWL_EXSTYLE, lngWindowStyle Or WS_EX_LAYERED
            
            SetLayeredWindowAttributes hwnd, 0, bAlpha, LWA_ALPHA
            
            ' Show + refresh
            ShowWindow hwnd, SW_SHOWNORMAL
            UpdateWindow hwnd
            
            Do
                SetLayeredWindowAttributes hwnd, 0, bAlpha, LWA_ALPHA
                
                If (Not ((bAlpha + lngStep) > lngAlphaMax)) Then
                    bAlpha = bAlpha + lngStep
                    
                  Else
                    bAlpha = lngAlphaMax
                    
                    SetLayeredWindowAttributes hwnd, 0, bAlpha, LWA_ALPHA
                    
                End If
                
            Loop Until bAlpha >= lngAlphaMax
    
            SetWindowLong hwnd, GWL_EXSTYLE, lngWindowStyle
    
          Else  ' udtOSVEr.dwMajorVersion < 5
            
            ShowWindow hwnd, SW_SHOWNORMAL
            
        End If
        
    End Sub

  2. #2

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Code colouring test

    VB Code:
    1. Public Sub FadeIn(ByVal hwnd As Long, _
    2.                   ByVal lngAlphaMax As Long, _
    3.                   Optional ByVal lngStep As Long = 1)
    4.     Dim udtOSVer            As OSVERSIONINFO
    5.     Dim bAlpha              As Byte
    6.     Dim lngWindowStyle      As Long
    7.    
    8.     udtOSVer.dwOSVersionInfoSize = Len(udtOSVer)
    9.    
    10.     GetVersionEx udtOSVer
    11.    
    12.     If udtOSVer.dwMajorVersion >= 5 Then
    13.    
    14.         bAlpha = 1
    15.            
    16.         lngWindowStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
    17.         SetWindowLong hwnd, GWL_EXSTYLE, lngWindowStyle Or WS_EX_LAYERED
    18.        
    19.         SetLayeredWindowAttributes hwnd, 0, bAlpha, LWA_ALPHA
    20.        
    21.         ' Show + refresh
    22.         ShowWindow hwnd, SW_SHOWNORMAL
    23.         UpdateWindow hwnd
    24.        
    25.         Do
    26.             SetLayeredWindowAttributes hwnd, 0, bAlpha, LWA_ALPHA
    27.            
    28.             If (Not ((bAlpha + lngStep) > lngAlphaMax)) Then
    29.                 bAlpha = bAlpha + lngStep
    30.                
    31.               Else
    32.                 bAlpha = lngAlphaMax
    33.                
    34.                 SetLayeredWindowAttributes hwnd, 0, bAlpha, LWA_ALPHA
    35.                
    36.             End If
    37.            
    38.         Loop Until bAlpha >= lngAlphaMax
    39.  
    40.         SetWindowLong hwnd, GWL_EXSTYLE, lngWindowStyle
    41.  
    42.       Else  ' udtOSVEr.dwMajorVersion < 5
    43.        
    44.         ShowWindow hwnd, SW_SHOWNORMAL
    45.        
    46.     End If
    47.    
    48. End Sub

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