News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Help with vertical bar

Started by guga, May 29, 2012, 12:48:57 PM

Previous topic - Next topic

guga

Hi guys...I need help trying to make a progressbar go vertical. I made this code to make it horizontal....but i need a similar one to make it vertical


        call 'USER32.CopyRect' rc2, rc1
        mov eax D@nBlocks | add eax D$Rc2.left
        mov D$Rc2.right eax
        call 'USER32.InflateRect' Rc2, 0-1, 0-1
        call 'USER32.CopyRect' Rc3, Rc2
         mov ecx D$Rc2.bottom | sub ecx D$Rc2.top

        lea eax D$ecx+ecx
        mov ecx 3
        cdq
        idiv ecx
        mov D@nBlocks eax

        mov ebx D$Rc2.right
        mov esi D$Rc2.left
        sub ebx esi

        lea edx D$eax+esi
        mov D$Rc3.left esi
        mov D$Rc3.right edx
        add esi 2

        ; Start building the progressbar in blocks (Effect similar to the on existing in system)
        While esi <s ebx

            call 'USER32.FillRect' D@finalDC, Rc3, D$edi+PRO_DATA.hBrushBkDis
            mov ecx D@nBlocks
            add esi ecx
            lea edx D$ecx+esi
            mov D$Rc3.left esi
            mov D$Rc3.right edx
            add esi 2

        End_While



What do is needed to make it go vertically using only the Rc (RECT) structure ? exchange rc.right with rc.bottom  ?

Regards,
Guga
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

qWord

AFAICS you must interchange:
rect.bottom <--> rect.right
rect.top <--> rect.left
MREAL macros - when you need floating point arithmetic while assembling!

guga

Hi qword

tks....it worked. Also, i needed to build a Y block a few lines of code before....Now the full code is:


    ; calculations
    mov eax D$edi+PRO_DATA.iHighDis | sub eax D$edi+PRO_DATA.iLowDis
    mov edx D$Rc1.right | sub edx D$Rc1.left
    mov ebx D$Rc1.bottom | sub ebx D$Rc1.top | mov D@nHeight ebx
    mov D@nRange eax
    mov D@nWidth edx
    mov D@nBlocks 100
    fild D$edi+PRO_DATA.iPosDis
    fild D$edi+PRO_DATA.iLowDis
    fsubp ST1 ST0
    fild D@nRange
    fdivp ST1 ST0
    fld ST0
    fild D@nBlocks
    fmulp ST1 ST0
    fistp D@nPct

    fild D@nWidth
    fild D@nHeight
    fmul ST0 ST2
    fistp D@nyBlocks
    fmulp ST1 ST0
    fistp D@nBlocks
   
    mov eax D$edi+PRO_DATA.dwStyleDis

        Test_If eax &PBS_VERTICAL
            mov D@IsVert &TRUE
            xor eax &PBS_VERTICAL
        Test_End

    ..If eax = CPBS_SYSTEM

        .If D@IsVert = &TRUE
            call 'USER32.CopyRect' rc2, rc1
            mov eax D@nyBlocks | add eax D$Rc2.top | mov D$Rc2.bottom eax
            call 'USER32.InflateRect' Rc2, 0-1, 0-1
            call 'USER32.CopyRect' Rc3, Rc2
       
            mov ecx D$Rc2.right | sub ecx D$Rc2.left

            lea eax D$ecx+ecx
            mov ecx 3 ; block divide ; if we mul here we are ok
            cdq
            idiv ecx
            mov D@nyBlocks eax

            mov ebx D$Rc2.bottom
            mov esi D$Rc2.top
            sub ebx esi

            lea edx D$eax+esi
            mov D$Rc3.top esi
            mov D$Rc3.bottom edx
            add esi 2

            ; Start building the progressbar in blocks (Effect similar to the on existing in system)
            While esi <s ebx

                call 'USER32.FillRect' D@finalDC, Rc3, D$edi+PRO_DATA.hBrushBkDis
                mov ecx D@nyBlocks
                add esi ecx
                lea edx D$ecx+esi
                mov D$Rc3.top esi
                mov D$Rc3.bottom edx
                add esi 2

            End_While

        .Else
           
            call 'USER32.CopyRect' rc2, rc1
            mov eax D@nBlocks | add eax D$Rc2.left | mov D$Rc2.right eax
            call 'USER32.InflateRect' Rc2, 0-1, 0-1
            call 'USER32.CopyRect' Rc3, Rc2
       
            mov ecx D$Rc2.bottom | sub ecx D$Rc2.top
       
            lea eax D$ecx+ecx
            mov ecx 3
            cdq
            idiv ecx
            mov D@nBlocks eax

            mov ebx D$Rc2.right
            mov esi D$Rc2.left
            sub ebx esi

            lea edx D$eax+esi
            mov D$Rc3.left esi
            mov D$Rc3.right edx
            add esi 2

            ; Start building the progressbar in blocks (Effect similar to the on existing in system)
            While esi <s ebx

                call 'USER32.FillRect' D@finalDC, Rc3, D$edi+PRO_DATA.hBrushBkDis
                mov ecx D@nBlocks
                add esi ecx
                lea edx D$ecx+esi
                mov D$Rc3.left esi
                mov D$Rc3.right edx
                add esi 2

            End_While

        .End_If
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com