Hello, why the SetTimer dosn't accept the EAX/EDX value after multiply ?
INVOKE atodw,ADDR EQU_Time
mov edx,60000
mul edx
INVOKE SetTimer, hDlg, 1, edx, NULL
:confused: :confused: :confused: :confused: :confused:
Greets Forginforcer
INVOKE atodw,ADDR EQU_Time
mov edx,60000
mul edx
INVOKE SetTimer, hDlg, 1, edx, NULL
:confused: :confused: :confused: :confused: :confused:
Greets Forginforcer
mul returns a 64 bit result in eax:edx. So edx is overwritten (probably with 0, if the resulting number isn't larger than 32 bits).
I know, but EAX isnt useable too.
:confused: :confused: :confused:
:confused: :confused: :confused:
What do you mean by EAX is not useable?
INVOKE SetTimer, hDlg, 1, eax, NULL
INVOKE atodw,ADDR EQU_Time
mov edx,60000
mul edx
INVOKE SetTimer, hDlg, 1, eax, NULL
INVOKE atodw,ADDR EQU_Time
mov edx,60000
mul edx
INVOKE SetTimer, hDlg, 1, eax, NULL
I still don't understand what you mean. Is the settimer function returning 0?
hmmm, how to get the right value ?
quote from api reference on SetTimer function
Return Values
If the function succeeds, the return value is an integer identifying the new timer. An application can pass this value, or the string identifier, if it exists, to the KillTimer function to destroy the timer. If the function fails to create a timer, the return value is zero.
Return Values
If the function succeeds, the return value is an integer identifying the new timer. An application can pass this value, or the string identifier, if it exists, to the KillTimer function to destroy the timer. If the function fails to create a timer, the return value is zero.
The compile dont accept this:
INVOKE SetTimer, hDlg, 1, eax, NULL
INVOKE SetTimer, hDlg, 1, eax, NULL
What assembler are you using? What is the error message you get?
And which "atodw" function are you using? The one from the MASM32 library?
Hutch:
The "atodw" function in the MASM32 library has the following code for loading ESI with the address of the string:
mov esi,
Does that assemble properly with MASM?
Raymond
Hutch:
The "atodw" function in the MASM32 library has the following code for loading ESI with the address of the string:
mov esi,
Does that assemble properly with MASM?
Raymond
Hi Red,
We went over this already, you asked the same thing in this thread and I explained the problems with your original proc. The one I supplied you works, are you passing a string to the atodw proc ? Did you find a book or text on the difference between numbers and strings ?
What is the problem you are having with the proc, post all the relavant data - where you are getting the data for the EQU_Time variable, what the compiler error is that you get and what results you get if you are able to compile.
Donkey
We went over this already, you asked the same thing in this thread and I explained the problems with your original proc. The one I supplied you works, are you passing a string to the atodw proc ? Did you find a book or text on the difference between numbers and strings ?
What is the problem you are having with the proc, post all the relavant data - where you are getting the data for the EQU_Time variable, what the compiler error is that you get and what results you get if you are able to compile.
Donkey
That should be my code, but it doesnt work:
I dont know, wich variable type I have to choose with EQU_Time.
INVOKE GetDlgItemText, hDlg, IDC_EDIT1, EQU_Time, 2
invoke atodw,ADDR EQU_Time
mov edx,60000
mul edx
INVOKE SetTimer, hDlg, 1, eax, NULL
Bye...
I dont know, wich variable type I have to choose with EQU_Time.
INVOKE GetDlgItemText, hDlg, IDC_EDIT1, EQU_Time, 2
invoke atodw,ADDR EQU_Time
mov edx,60000
mul edx
INVOKE SetTimer, hDlg, 1, eax, NULL
Bye...
INVOKE GetDlgItemText, hDlg, IDC_EDIT1, EQU_Time, 2
invoke atodw,ADDR EQU_Time
For the first function call you use the content of the variable EQU_Time as a parameter. In the very next function call you use its address as the parameter.
invoke atodw,ADDR EQU_Time
I would strongly recommend that you download the Win32 Programmers' Reference and study IN DETAIL the requirements of each function you intend to call and understand which parameters are required.
You should then have much less problems with your code.
Raymond
Red,
You consistently ignore everything that I have shown you. If I have put ADDR in front of a parameter it is because that is required in the context you are using. In my original example I demonstrated it this way :Why did you remove the ADDR from the example ? Was there a specific reason for this ?
EDIT : Added the rest of the example and code tags
You consistently ignore everything that I have shown you. If I have put ADDR in front of a parameter it is because that is required in the context you are using. In my original example I demonstrated it this way :
.data
; Create a string buffer to hold the text from the edit control
EQU_Time BYTE 4 DUP (0) ; you only read 2 bytes so make it 4 long for the null terminator + alignment
.Code
[i]; copy the text from the edit control into your string buffer[/i]
INVOKE GetDlgItemText, hDlg, IDC_EDIT1, [COLOR=red]ADDR EQU_time[/COLOR], 2
[i]; convert the string in the buffer to a numeric DWORD value[/i]
invoke atodw,ADDR EQU_Time
[i]; perform the math in one operation instead of splitting it in two[/i]
mov edx,60000
mul edx
[i]; The result is in EAX you cannot use it in EQU_Time as that is a [COLOR=red]String[/COLOR] buffer[/i]
EDIT : Added the rest of the example and code tags