### Author Topic: Draw Text with Button To show & Remove  (Read 17156 times)

#### hfheatherfox07

• Member
• Posts: 464
##### Re: Draw Text with Button To show & Remove
« Reply #30 on: August 24, 2012, 01:25:06 AM »
Almost ....
The Only Problem Is that Pause .... any Ideas ?
We are the ASM Borg and you will become part of us. Compile and be assembled.

#### hfheatherfox07

• Member
• Posts: 464
##### Re: Draw Text with Button To show & Remove
« Reply #31 on: August 24, 2012, 01:42:36 AM »
It Looks A little  Better with a Base Colour
We are the ASM Borg and you will become part of us. Compile and be assembled.

#### qWord

• Member
• Posts: 1473
• The base type of a type is the type itself
##### Re: Draw Text with Button To show & Remove
« Reply #32 on: August 24, 2012, 02:18:14 AM »
hi,
you can design the program more flexible and efficiently by using tables for the colors:
Code: [Select]
`.486.model flat, stdcalloption casemap: none; API functions; ¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤include  \masm32\include\windows.incinclude  \masm32\include\user32.incinclude  \masm32\include\kernel32.incinclude  \masm32\include\comctl32.incinclude  \masm32\include\masm32.incinclude  \masm32\include\gdi32.inc includelib  \masm32\lib\user32.libincludelib  \masm32\lib\kernel32.libincludelib  \masm32\lib\comctl32.libincludelib  \masm32\lib\masm32.libincludelib  \masm32\lib\gdi32.lib; ¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤; Prototype ; ¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤DialogProc   PROTO : HWND, : UINT, : WPARAM, : LPARAM.const; Resource ids; ¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤IDD_DLG1        equ 101IDI_ICON        equ 200.data    szTitle          db "Flashing Colours", 0    szText           db "TextAnim Colours!", 0    Font            LOGFONTA    <35,0,0,0,700,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,\                             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, 0,"Times New Roman">     hFont  HANDLE 0        i_state     DWORD 0    colors      DWORD 0000FFFFh                DWORD 000080FFh                DWORD 000000FFh    n_states    DWORD (\$-colors)/4.data?    hInstance HINSTANCE ?    hIcon     HICON     ?.codestart:INVOKE GetModuleHandle, NULLmov hInstance, eaxINVOKE LoadIcon, eax, IDI_ICON mov hIcon, eaxINVOKE InitCommonControlsINVOKE DialogBoxParam, hInstance, IDD_DLG1 , NULL, ADDR DialogProc, 0INVOKE ExitProcess, 0DialogProc proc uses ebx hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAMLOCAL ps:PAINTSTRUCTLOCAL rc:RECTLOCAL hdc:HDC    .IF uMsg == WM_INITDIALOG            INVOKE SetWindowText, hWnd, addr szTitle         INVOKE SendMessage, hWnd, WM_SETICON,ICON_SMALL, hIcon                ; CreateFont:        INVOKE CreateFontIndirect,addr Font        mov hFont,eax                   invoke SetTimer,hWnd, 1, 300, NULL                invoke InvalidateRect, hWnd, NULL, TRUE        mov eax,1        ret    .ELSEIF uMsg == WM_TIMER        .IF wParam ==1            inc i_state            mov eax,n_states            .if i_state >= eax                mov i_state,0            .endif            invoke InvalidateRect, hWnd, NULL, TRUE            mov eax,1            ret        .ENDIF    .ELSEIF uMsg ==  WM_PAINT        invoke BeginPaint, hWnd, ADDR ps                mov ebx,i_state            invoke SetTextColor, ps.hdc, colors[ebx*4]        invoke SelectObject, ps.hdc, hFont        push eax        invoke SetBkMode, ps.hdc, TRANSPARENT        invoke TextOut, ps.hdc, 60, 30, ADDR szText, SIZEOF szText - 1        pop eax                invoke SelectObject, ps.hdc, eax        invoke EndPaint, hWnd, ADDR ps        mov eax,1        ret    .ELSEIF uMsg == WM_CLOSE        INVOKE DeleteObject, hFont        INVOKE KillTimer,hWnd,1        INVOKE EndDialog, hWnd, 0    .ENDIF    xor eax,eax    ret    DialogProc endpend start`BTW:  you should indent your code proper.
MREAL macros - when you need floating point arithmetic while assembling!

#### hfheatherfox07

• Member
• Posts: 464
##### Re: Draw Text with Button To show & Remove
« Reply #33 on: August 24, 2012, 02:30:16 AM »
Thanks qWord !
Funny I was just looking at an old attachment of yours when you posted this...

Your old sintext- see if I can change the algo there to do the back and forth wavering ....
accept I need a another decade or so to understand what I am doing LOL
We are the ASM Borg and you will become part of us. Compile and be assembled.

#### hfheatherfox07

• Member
• Posts: 464
##### Re: Draw Text with Button To show & Remove
« Reply #34 on: August 24, 2012, 02:42:27 AM »
LMAO

Well qWord .....
This Is a problem the text is falling ....