The MASM Forum Archive 2004 to 2012

Project Support Forums => The GeneSys Development System => User Contributed Code => Topic started by: Vortex on September 10, 2006, 09:47:22 AM

Title: Another autoyping demo
Post by: Vortex on September 10, 2006, 09:47:22 AM
Hi friends,

Here is another autotyping demo. This time, the characters of a message are sent to an edit box. The source code does not have any invoke statements to call API functions, this is accomplished with the usage of some macro techniques :

.
.
GetModuleHandle,NULL
mov hInstance,eax
DialogBoxParam,hInstance,ADDR DlgName,NULL,ADDR DlgProc,NULL
ExitProcess,eax
.
.


EXTERNDEF ExitProcess@4:PROC
ExitProcess EQU <invoke pr1 PTR ExitProcess@4>

EXTERNDEF GetModuleHandleA@4:PROC
GetModuleHandle EQU <invoke pr1 PTR GetModuleHandleA@4>

EXTERNDEF DialogBoxParamA@20:PROC
DialogBoxParam EQU <invoke pr5 PTR DialogBoxParamA@20>



prX macros are defined in windows.inc like the following :

ArgCount MACRO number
      LOCAL txt
      txt equ <typedef PROTO :DWORD>
        REPEAT number - 1
          txt CATSTR txt,<,:DWORD>
        ENDM
      EXITM <txt>
    ENDM

    pr0  typedef PROTO
    pr1  ArgCount(1)
    pr2  ArgCount(2)
    pr3  ArgCount(3)
    pr4  ArgCount(4)
.
.

[attachment deleted by admin]
Title: Re: Another autoyping demo
Post by: PBrennick on September 10, 2006, 11:09:43 AM
Vortex,
That is a very nice example, a good addition to the GeneSys Project.  I think that this can be used to add an interesting effect to a program.

Paul
Title: Re: Another autoyping demo
Post by: Vortex on September 10, 2006, 11:53:27 AM
Hi Paul,

Using the technique as an effect to support a program is a nice idea. One can play with the time-out value of SetTimer to modify the typing rate of the characters.
Title: Re: Another autoyping demo
Post by: timertik on March 24, 2007, 03:18:31 AM
when I try to use this it doesnt compile
I get 2 error's

application.obj : error LNK2001: unresolved external symbol _KillTimer1@8
application.obj : error LNK2001: unresolved external symbol _SetTimer1@16



the editbox.inc looks like this

EXTERNDEF KillTimer1@8:PROC
KillTimer1 EQU <invoke pr2 PTR KillTimer1@8>

EXTERNDEF SetTimer1@16:PROC
SetTimer1 EQU <invoke pr4 PTR SetTimer1@16>


I removed all but the required data

I do not understand this code it doesnt look like what im used to

please note that I am already using KillTimer and SetTimer in my application
i get errors when using multiple killtimer and settimer
so I tried renaming all of your code to KillTimer1 and SetTimer1 and it seems to work but it will not accept the code in editbox.inc
Title: Re: Another autoyping demo
Post by: Vortex on March 24, 2007, 09:23:13 AM
timertik,

You are trying to rename the original API functions, this why you are receiving error messages :

EXTERNDEF KillTimer1@8:PROC
.
.

EXTERNDEF SetTimer1@16:PROC
.
.


You should not insert the extra character "1" to rename the APIs, they must remain intact.



Title: Re: Another autoyping demo
Post by: timertik on March 24, 2007, 10:11:02 AM
if they remain intact I get different errors
Nevermind I somehow didnt notice the comments at the top stating you didnt use invoke if i add invoke it compiles It works fine now
i will try to improve it to my needs if thats ok with you.
thanks for the example  :U

I have been mixing things up and I wonder if it can work to change the caption of a dialog and type it out
I tried:
invoke SetWindowText,hWin,editboxtext
but it doesnt type it like it would in an edit box it just leaves it blank
I wil look at it some more I am very new to macros so I dont know much but i will try to make it repeat after it has typed it out
Title: Re: Another autoyping demo
Post by: Vortex on March 24, 2007, 12:19:14 PM
timertik,

OK, this time, I removed all the macros and replaced them with the invoke statement. To change the caption, you can send the WM_SETTEXT message to the dialog box :

invoke SendMessage,hWnd,WM_SETTEXT,0,ADDR caption

I modified the demo to set the caption with the autotype effect.

[attachment deleted by admin]
Title: Re: Another autoyping demo
Post by: timertik on March 25, 2007, 02:28:06 AM
thanks this is what i was trying to do
:U
I will have to do more research on WM_SETTEXT I never used that one before  :clap: