The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: hutch-- on August 09, 2005, 10:38:15 AM

Title: Scrolling a dialog caption
Post by: hutch-- on August 09, 2005, 10:38:15 AM
I know small things amuse small minds but I have an excuse, this one took slightly less than 5 minutes to write. A member in the win32asm forum asked how it was done so I pelted this one together and posted it here.

[attachment deleted by admin]
Title: Re: Scrolling a dialog caption
Post by: P1 on August 09, 2005, 09:50:56 PM
Just for fun, I would like to have the caption scroll follow the mouse around inside the window.   :green2

Regards,  P1  :8)
Title: Re: Scrolling a dialog caption
Post by: PBrennick on August 10, 2005, 12:16:53 AM
Nice effect!  And I can think of a use for it...
Paul
Title: Re: Scrolling a dialog caption
Post by: hutch-- on August 10, 2005, 02:09:29 AM
Optimisation is a form of addiction but a least its good pactice.  :bg

Here is the algo in the example tweaked a little.


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

OPTION PROLOGUE:NONE                ; turn off the stack frame
OPTION EPILOGUE:NONE

rotate_caption proc pbuf:DWORD

    mov edx, [esp+4]                ; load string address in EDX
    mov cl, [edx]                   ; get 1st byte of string
    add edx, 1                      ; move to next location in string

  @@:
    mov al, [edx]                   ; read character into AL
    add edx, 1                      ; increment addess
    test al, al                     ; test if AL = 0
    jz @F                           ; exit loop if it is
    mov [edx-2], al                 ; write AL back to buffer
    jmp @B

  @@:
    mov [edx-2], cl                 ; write 1st byte to end
    mov BYTE PTR [edx-1], 0         ; write terminator

    ret 4                           ; balance the stack

rotate_caption endp

OPTION PROLOGUE:PrologueDef         ; turn it back on again
OPTION EPILOGUE:EpilogueDef

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
Title: Re: Scrolling a dialog caption
Post by: Vortex on August 10, 2005, 09:45:54 AM
Hi Hutch,

Nice demo :U