NO

Author Topic: Scrolling text effect  (Read 3927 times)

Offline Vortex

  • Member
  • *
  • Posts: 867
    • http://www.vortex.masmcode.com
Scrolling text effect
« on: May 12, 2011, 08:52:57 PM »
Here is an example of scrolling text effect :

Code: [Select]

include Scrolltest.inc

.data

DlgBox  db 'DLGBOX',0
TextMsg db '      This is a scrolling text message ',0
CharPos dd 0

.data?

hBrush    dd ?

.code

start:

    invoke  GetModuleHandle,0
    invoke  DialogBoxParam,eax,ADDR DlgBox,0,ADDR DlgProc,0
    invoke  ExitProcess,eax

DlgProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

LOCAL hdc:DWORD
LOCAL ps:PAINTSTRUCT
LOCAL rc:RECT

    .IF uMsg==WM_INITDIALOG

        invoke    SetTimer,hWnd,ID_TIMER,300,ADDR TimerProc

    .ELSEIF uMsg==WM_CTLCOLORDLG

        invoke   CreateSolidBrush,White
        mov       hBrush,eax
        ret

    .ELSEIF uMsg==WM_CLOSE

        invoke    EndDialog,hWnd,0

    .ELSEIF uMsg==WM_PAINT

        invoke    BeginPaint,hWnd, ADDR ps
        mov       hdc,eax
        invoke    GetClientRect,hWnd,ADDR rc
        mov       rc.left,100
        mov       edx,OFFSET TextMsg
        add       edx,CharPos
        mov       ecx,39
        sub       ecx,CharPos
        invoke    DrawText,hdc,edx,ecx,ADDR rc,0
        invoke    EndPaint,hWnd,ADDR ps

    .ELSE

        xor eax,eax
        ret

    .ENDIF

    mov    eax,TRUE
    ret

DlgProc ENDP

TimerProc PROC hWnd:DWORD,uMsg:DWORD,idEvent:DWORD,dwTime:DWORD

        cmp     CharPos,38
        jne     @f
        invoke  KillTimer,hWnd,ID_TIMER
        ret
@@:
        inc     CharPos
        invoke  InvalidateRect,hWnd,0,TRUE
        ret

TimerProc ENDP

END start
Code it... That's all...