News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Fade in window algo

Started by hutch--, September 28, 2005, 11:08:40 PM

Previous topic - Next topic

hutch--

I found the idea in Bill Cravener's example code so I played wit it to make it self contained and update the window that is being faded in. I tested it with the editor I write called TopGun and it apears to work fine. The additional UpdateWindow calls in the loop are so they other windows in the interface are updated as well as the parent window. This code will not work on a pre win2000 os version.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

WindowFadeIn proc hWin:DWORD,msdelay:DWORD,step:DWORD,swattr:DWORD

    ; --------------------------------------------------
    ; hWin      = handle of window to fade in.
    ; msdelay   = delay between fade level changes
    ; step      = incremental fade rate change up to 255
    ; swattr    = ShowWindow style
    ; --------------------------------------------------

    LOCAL wstyle    :DWORD

    push esi
    xor esi, esi

    invoke GetWindowLong,hWin,GWL_EXSTYLE           ; get current window style
    mov wstyle, eax
    or eax,WS_EX_LAYERED
    invoke SetWindowLong,hWin,GWL_EXSTYLE,eax       ; add the WS_EX_LAYERED style

    invoke SetLayeredWindowAttributes,hWin,0,0,2

    invoke ShowWindow,hWin,swattr

  doloop:
    invoke SetLayeredWindowAttributes,hWin,esi,esi,1 or 2
    invoke Sleep, msdelay

    invoke UpdateWindow,hEdit
    invoke UpdateWindow,hRebar
    invoke UpdateWindow,hStatus
    invoke UpdateWindow,hWin

    add esi,step
    cmp esi,255
    jl doloop

    invoke SetLayeredWindowAttributes,hWin,0,255,2
    invoke UpdateWindow,hWin

    invoke SetWindowLong,hWin,GWL_EXSTYLE,wstyle    ; restore original window style

    pop esi

    ret

WindowFadeIn endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Farabi

Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Biterider

Hi Hutch
Here the Window Fade in and out of the ObjMem32 library. It autodetects the OS and executes the code if the APIs are supported. The APIs are loaded dynamically to prevent startup problems with static linking.

Regards

Biterider



[attachment deleted by admin]

hutch--

Biterider,

Compliments, nice piece of code. The version detect is a good idea if the app is designed to run on 9x as well as later systems.  :U
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php