#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TIMER Jase Excel Discussion (Misc queries) 1 September 8th 08 10:22 PM
Timer in VBA peyman Excel Discussion (Misc queries) 2 October 5th 07 06:53 PM
Timer Brandon H Excel Discussion (Misc queries) 5 August 9th 07 01:54 PM
Timer Vijay Excel Worksheet Functions 1 April 6th 07 11:00 AM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM


All times are GMT +1. The time now is 11:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"