![]() |
Timers outside of main proc -
Sup guys,
For some reason when I call SetTimer(...) from outside my main window procedure it doesn't do anything. Why is that? How can I get through this? Thanks. |
Re: Timers outside of main proc -
post code -- its a little hard to see from where I'm sitting right now.
|
Re: Timers outside of main proc -
Again, the answer is RTFM: go to MSDN and do a search for "SetTimer" and then attempt to understand what the documentation says.
|
Re: Timers outside of main proc -
Here's the code -
:
If you test it, you would notice that the function that was called from with in the main procedure works while the one from the function SetTimerC does not. Why is that? Thanks. |
Re: Timers outside of main proc -
If you mean line 118, then check the value of the global variable hWnd -- it was never set to anything. Line 37 set the value of hWnd which was declared on line 16. Delete line 16 and your program will probably work. You also need to delete either line 104 or 105 because you don't need them both.
|
Re: Timers outside of main proc -
To put in another way, the value of hWnd within WndProc() is passed as an argument (so the system generally ensures it points at a window). Within SetTimerC(), hWnd (as Dragon said) is an uninitialised global. Either pass a valid window handle as an argument to SetTimerC() or set the global so it is a valid handle.
|
Re: Timers outside of main proc -
Thank you guys! It works great now! :) RESOLVED
|
| All times are GMT -5. The time now is 12:43 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC