0 Replies - 1395 Views - Last Post: 24 July 2011 - 01:43 PM

#1 GunnerInc   User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 917
  • View blog
  • Posts: 2,358
  • Joined: 28-March 11

Autotype string

Posted 24 July 2011 - 01:43 PM

Description: Best way is to add push 20 push offset szStuffToType push hEdit call AutoTypeProc to its own threadLoops through zero terminated string and types each char into edit control
AutoTypeProc:
    ; ebp+8 == Edit window handle
    ; ebp+12 == pointer to zero terminated string
    ; ebp+16 == milliseconds of pause after each char
    push    ebp
    mov     ebp,esp
    push    esi
    
    mov     esi, [ebp+12]     ; buffer of text to "print"

PrintChar:
    ;############################
    movzx   eax, byte ptr [esi] ; next char in buffer
    test    eax, eax            ; are we at the end?
    jz      Done                ; yup
    
    ;############################
    push    NULL                ;
    push    eax                 ; char to print
    push    WM_CHAR             ;
    push    [ebp+8]             ; handle of edit control
    call    SendMessage         ; print it
    
    ;############################
    push    [ebp+16]            ;
    call    Sleep               ; take a little nap
    
    inc     esi                 ; 
    jmp     PrintChar           ; 

Done:
    pop     esi
    leave  
    ret     12


Is This A Good Question/Topic? 0
  • +

Page 1 of 1