Hi, how to Set a Timer through a other funktion.
I only can set the timer with result in the WINPROC.
I tryed to call the Settimerfunktion with NULL als hwnd, but then the timer isnt seted, so how to set the timer ?
WndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
.....
.ELSEIF eax==WM_TIMER
.........
..........
.ENDIF
.....
INVOKE SetTimer, hWnd, 1, 1000, NULL ; work !!!!!!!!!!!!!!!!
.....
WndProc ENDP
otherfunktion PROC
INVOKE SetTimer, NULL, 1, 1000, NULL ; doesnt work !!!!!!!!!!!!!!!!!!!! how to call this funktion, that it work ?
ret
otherfunktion ENDP
I only can set the timer with result in the WINPROC.
I tryed to call the Settimerfunktion with NULL als hwnd, but then the timer isnt seted, so how to set the timer ?
WndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
.....
.ELSEIF eax==WM_TIMER
.........
..........
.ENDIF
.....
INVOKE SetTimer, hWnd, 1, 1000, NULL ; work !!!!!!!!!!!!!!!!
.....
WndProc ENDP
otherfunktion PROC
INVOKE SetTimer, NULL, 1, 1000, NULL ; doesnt work !!!!!!!!!!!!!!!!!!!! how to call this funktion, that it work ?
ret
otherfunktion ENDP
I think you have to set the timer like this:
.IF uMsg==WM_CREATE
invoke SetTimer.....
.IF uMsg==WM_CREATE
invoke SetTimer.....
I did, but the I have the problem with the settimer call in the otherfunktion funktion...
If you want to associate your main window with the timer,try to use hWnd instead of NULL.
@Vortex thanks for your attention...
i already tryed, but in the funktion, i call settimer, i havn't hWnd.
do you know a solution
i already tryed, but in the funktion, i call settimer, i havn't hWnd.
do you know a solution
INVOKE SetTimer........<-----Try to put here the second SetTimer function.
INVOKE ShowWindow, hwnd,SW_SHOWNORMAL
INVOKE UpdateWindow, hwnd
.WHILE TRUE
INVOKE GetMessage, ADDR msg,NULL,0,0
Last param in SetTimer is for addr of function that is called
on timer.
on timer.
Hi at all.
I dont understand your code as well.
im a bloody beginner. I'm programming youst a few month.
I dont understand your code as well.
im a bloody beginner. I'm programming youst a few month.
invoke INVOKE SetTimer, NULL, 1, 1000, offset OnTimerProc
....
OnTimerProc proc a1,a2,a3,a4
;do here what do you want when the timer "beeps" :)
ret
OnTimerProc endp
The Svin has right,you must to specify the function name when you are setting the timer.
The SetTimer function creates a timer with the specified time-out value.
UINT SetTimer(
HWND hWnd, // handle of window for timer messages
UINT nIDEvent, // timer identifier
UINT uElapse, // time-out value
TIMERPROC lpTimerFunc // address of timer procedure
);
Parameters
hWnd
Identifies the window to be associated with the timer. This window must be owned by the calling thread. If this parameter is NULL, no window is associated with the timer and the nIDEvent parameter is ignored.
nIDEvent
Specifies a nonzero timer identifier. If the hWnd parameter is NULL, this parameter is ignored.
uElapse
Specifies the time-out value, in milliseconds.
lpTimerFunc
Points to the function to be notified when the time-out value elapses. For more information about the function, see TimerProc.
If lpTimerFunc is NULL, the system posts a WM_TIMER message to the application queue. The hwnd member of the message's MSG structure contains the value of the hWnd parameter.
I just want to stress that in the case the function would be call back function and need to be written with 4 params frame.
Otherwise you'd have problems.
Otherwise you'd have problems.
Ohhhhhhh ! THX
I've just written an example for you.
The app doesn't haveany window at all, though it uses
2 timers and two relative timer's procs
One to make some sound
The other to shut down the app when set time ellapsed.
BTW: I don't think the topic fits to this section.
But it's up to moderators of course.
The app doesn't haveany window at all, though it uses
2 timers and two relative timer's procs
One to make some sound
The other to shut down the app when set time ellapsed.
BTW: I don't think the topic fits to this section.
But it's up to moderators of course.
Thx !
The sounds are very funny.
The sounds are very funny.
how to kill teh timer ?
i tryed "invoke KillTimer,0, 0"
i tryed "invoke KillTimer,0, 0"
RTFM.
When you SetTimer save returned value from the
func and use it as the second param to KillTimer
When you SetTimer save returned value from the
func and use it as the second param to KillTimer
How I can get the returned value ?
I already read e lot ! - I Think i read crap, where i can get a got tut ?
i thougt, if i set a timer with the ID 0 then can kill it with the ID 0.....
I already read e lot ! - I Think i read crap, where i can get a got tut ?
i thougt, if i set a timer with the ID 0 then can kill it with the ID 0.....
RTFM!!! Open Win32.hlp on SetTimer and KillTimer
and carefully RTFM it's just a few lines.
Returned value is value you have in eax after
SetTimer call.
If you use SetTimer with 0 as the first param - ID is in return value. And ID you specifyed - is totaly ignored.
Save it in some var and use in KillTimer when needed.
I don't know what do you mean by e-lot but all this
just a few lines in Win32.hlp about KillTimer function.
and carefully RTFM it's just a few lines.
Returned value is value you have in eax after
SetTimer call.
If you use SetTimer with 0 as the first param - ID is in return value. And ID you specifyed - is totaly ignored.
Save it in some var and use in KillTimer when needed.
I don't know what do you mean by e-lot but all this
just a few lines in Win32.hlp about KillTimer function.
mist !
I cant delete the timer !
Why ???
look i have the follwoing funktion:
INVOKE SetTimer, hwnd, 10, 1000, offset OnTimer1
mov TimerID, EAX
OnTimer1 proc a1,a2,a3,a4
invoke KillTimer, hwnd, TimerID
invoke KillTimer, hwnd, 10
.......
INVOKE MessageBox, NULL, NULL, NULL, NULL
ret
OnTimer1 ENDP
Need Help !
I cant delete the timer !
Why ???
look i have the follwoing funktion:
INVOKE SetTimer, hwnd, 10, 1000, offset OnTimer1
mov TimerID, EAX
OnTimer1 proc a1,a2,a3,a4
invoke KillTimer, hwnd, TimerID
invoke KillTimer, hwnd, 10
.......
INVOKE MessageBox, NULL, NULL, NULL, NULL
ret
OnTimer1 ENDP
Need Help !
I've said that your ID specified in SetTimer is ignored
when you don't use hWnd and you have to use retrurned value as ID.
Yet you do in reverse - using your ID and not using returnd value:
Red Forginforcer, I think you have to learn the asm language itself first, then start with API.
'Cause if you don't understand some basics like what is
returned value and how to save it - you'll have problems and missunderstanding on every step.
bitRake: Please, think about removing this thread to
Main section. I doesn't seem fit here.
when you don't use hWnd and you have to use retrurned value as ID.
Yet you do in reverse - using your ID and not using returnd value:
.data
tmrID dd ?
.code
;to set timer and save it's ID
invoke SetTimer,0,0,1000,offset OnTimerProc
mov tmrID,eax ;!!!!Save returned value!!!
;...........
;to kill timer use the saved ID
invoke KillTimer,0,tmrID ;!!!Use the returned from ;SetTimer value!!!!
Red Forginforcer, I think you have to learn the asm language itself first, then start with API.
'Cause if you don't understand some basics like what is
returned value and how to save it - you'll have problems and missunderstanding on every step.
bitRake: Please, think about removing this thread to
Main section. I doesn't seem fit here.