News:

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

Scrolling a dialog caption

Started by hutch--, August 09, 2005, 10:38:15 AM

Previous topic - Next topic

hutch--

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]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

P1

Just for fun, I would like to have the caption scroll follow the mouse around inside the window.   :green2

Regards,  P1  :8)

PBrennick

Nice effect!  And I can think of a use for it...
Paul
The GeneSys Project is available from:
The Repository or My crappy website

hutch--

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

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

Vortex