Results 1 to 6 of 6

Hybrid View

  1. #1
    [implicit]'s Avatar
    Join Date
    Oct 2012
    Gender
    male
    Posts
    16
    Reputation
    10
    Thanks
    1
    My Mood
    Cynical
    Shit's dead as fuck :\

    Fasm snippet to fade a window in, called either in WM_CREATE or after window creation:
    Code:
    fade_time = 1000
    
    ; start fading
            invoke GetWindowLong,[hWnd],GWL_EXSTYLE
            or eax, WS_EX_LAYERED
            invoke SetWindowLong,[hWnd],GWL_EXSTYLE,eax
            invoke GetTickCount
            mov ebx, eax
       .sfade:
            invoke GetTickCount
            sub eax, ebx
            cmp eax, fade_time
            jge .efade
            shl eax, 8
            cdq
            mov ecx, fade_time
            div ecx
            invoke SetLayeredWindowAttributes,[hWnd],0,eax,LWA_ALPHA
       ; check for window messages so it can still be controlled while we fade
       @@:
            xor eax, eax
            invoke PeekMessage,msg,eax,eax,eax,PM_REMOVE
            test eax, eax
            jz @f
            invoke TranslateMessage, msg
            invoke DispatchMessage, msg
            jmp @b
       @@:
            invoke Sleep, 10
            jmp .sfade
       .efade:
            invoke GetWindowLong,[hWnd],GWL_EXSTYLE
            mov edx, WS_EX_LAYERED
            not edx
            and eax, edx
            invoke SetWindowLong,[hWnd],GWL_EXSTYLE,eax
       ; end fading
    and for fading the window out just put "xor eax, 00FFh" after the div ecx.
    Last edited by [implicit]; 11-05-2012 at 01:22 AM.

Similar Threads

  1. [Collection]Snippets Vault[C#]
    By NextGen1 in forum C# Programming
    Replies: 21
    Last Post: 10-13-2019, 10:48 AM
  2. [Source Code] Snippets Vault
    By NextGen1 in forum Visual Basic Programming
    Replies: 112
    Last Post: 06-14-2019, 07:51 PM
  3. [Collection]Snippets Vault[PHP]
    By NextGen1 in forum PHP Programming
    Replies: 13
    Last Post: 10-13-2018, 09:10 PM
  4. [Collection]Snippets Vault[Flash]
    By NextGen1 in forum Flash & Actionscript
    Replies: 3
    Last Post: 10-14-2011, 03:08 AM
  5. [Collection]Snippets Vault[D3D]
    By NextGen1 in forum DirectX/D3D Development
    Replies: 0
    Last Post: 09-28-2010, 08:36 AM