Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
API Timer
I am using the API timer functions to emulate the VB
timer capability in an Excel project (see following code): -------------------------------------------------------- Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, _ ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public TimerID As Long Public TimerSeconds As Single Sub StartTimer() TimerSeconds = 1 ' how often to "pop" the timer. TimerID = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressOf TimerProc) End Sub Sub EndTimer() On Error Resume Next KillTimer 0&, TimerID End Sub Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, _ ByVal nIDEvent As Long, ByVal dwTimer As Long) ' My code here End Sub -------------------------------------------------------- OK, so everything works well until I call the EndTimer function (I call this function when I terminate a userform). I go back to the Excel interface but I can't use the mouse to click on anything (cells, toolbars, etc.). Anybody know what is going on here? Thanks, Seth |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
API Timer
Seth,
I don't get this problem. You do have XL2000 or later don't you? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Seth" wrote in message ... I am using the API timer functions to emulate the VB timer capability in an Excel project (see following code): -------------------------------------------------------- Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, _ ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public TimerID As Long Public TimerSeconds As Single Sub StartTimer() TimerSeconds = 1 ' how often to "pop" the timer. TimerID = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressOf TimerProc) End Sub Sub EndTimer() On Error Resume Next KillTimer 0&, TimerID End Sub Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, _ ByVal nIDEvent As Long, ByVal dwTimer As Long) ' My code here End Sub -------------------------------------------------------- OK, so everything works well until I call the EndTimer function (I call this function when I terminate a userform). I go back to the Excel interface but I can't use the mouse to click on anything (cells, toolbars, etc.). Anybody know what is going on here? Thanks, Seth |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
API Timer
Yes, I have XL XP.
The problem is that once i turn off the timer, I cannot get back into Excel (i.e., I can't click on anything, I just get the standard mouse pointer - I can't select cells, click buttons or anything). It is like Excel is frozen almost, but I can still edit in the VBE. It is odd, and I wasn't sure if anyone else had experienced this. Seth -----Original Message----- Seth, I don't get this problem. You do have XL2000 or later don't you? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Seth" wrote in message ... I am using the API timer functions to emulate the VB timer capability in an Excel project (see following code): ------------------------------------------------------- - Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, _ ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public TimerID As Long Public TimerSeconds As Single Sub StartTimer() TimerSeconds = 1 ' how often to "pop" the timer. TimerID = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressOf TimerProc) End Sub Sub EndTimer() On Error Resume Next KillTimer 0&, TimerID End Sub Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, _ ByVal nIDEvent As Long, ByVal dwTimer As Long) ' My code here End Sub ------------------------------------------------------- - OK, so everything works well until I call the EndTimer function (I call this function when I terminate a userform). I go back to the Excel interface but I can't use the mouse to click on anything (cells, toolbars, etc.). Anybody know what is going on here? Thanks, Seth . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TIMER | Excel Discussion (Misc queries) | |||
Timer in VBA | Excel Discussion (Misc queries) | |||
Timer | Excel Discussion (Misc queries) | |||
Timer | Excel Worksheet Functions | |||
Stopping a Timer / Running a timer simultaneously on Excel | Excel Discussion (Misc queries) |