![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Dec 2007
Posts: 93
Rep Power: 1
![]() |
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. |
|
|
|
|
|
#2 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 499
Rep Power: 4
![]() |
Re: Timers outside of main proc -
post code -- its a little hard to see from where I'm sitting right now.
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,198
Rep Power: 5
![]() |
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.
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Dec 2007
Posts: 93
Rep Power: 1
![]() |
Re: Timers outside of main proc -
Here's the code -
c Syntax (Toggle Plain Text)
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. Last edited by Ancient Dragon; Jan 26th, 2008 at 8:53 AM. Reason: add line numbers |
|
|
|
|
|
#5 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 499
Rep Power: 4
![]() |
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.
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,198
Rep Power: 5
![]() |
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.
|
|
|
|
|
|
#7 |
|
Programmer
Join Date: Dec 2007
Posts: 93
Rep Power: 1
![]() |
Re: Timers outside of main proc -
Thank you guys! It works great now!
RESOLVED |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Return type - main() / ISO C standard | sharadpro | C | 2 | Mar 14th, 2007 6:02 AM |
| Call the class main function | quantalfred | Java | 6 | Jul 23rd, 2006 1:38 PM |
| OOT Program Examples | Sane | Other Scripting Languages | 4 | Nov 25th, 2005 12:06 AM |
| noob questions about main() format | linuxpimp20 | C | 16 | Jul 11th, 2005 7:48 AM |
| Returning a value from a variable to the main function | colt | C | 3 | Apr 28th, 2005 7:56 AM |