View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default AddressOf / Windows API question

Amos,

I presume that you mean Ken Getz;'s routine. Here is an example that I use

Public Function fncWindowsTimer(TimeInterval As Long, WindowsTimer As Long)
As Boolean
WindowsTimer = 0
'if Excel2000 or above use the built-in AddressOf operator to
'get a pointer to the callback function
If Val(Application.Version) 8 Then
WindowsTimer = SetTimer(hWnd:=FindWindow("XLMAIN",
Application.Caption), _
nIDEvent:=0, _
uElapse:=TimeInterval, _
lpTimerFunc:=AddrOf_Callback_Routine)
Else 'use K.Getz & M.Kaplan function to get a pointer
WindowsTimer = SetTimer(hWnd:=FindWindow("XLMAIN",
Application.Caption), _
nIDEvent:=0, _
uElapse:=TimeInterval, _
lpTimerFunc:=AddrOf("cbkRoutine"))
End If

fncWindowsTimer = CBool(WindowsTimer)

End Function


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Amos" wrote in message
...
I am trying to write a piece of code that will determine
the address of a routine/function that will work in both
Office 97 and Office XP. I am needing this address for use
in using some of the Windows API functionality. I have
found a piece of code that helps me do this for VBE 5
(Office 97). The problem now is getting this functionality
in VBE 6(Office XP). I have read on a few sites that VBE 6
has a built-in 'AddressOf' function. This would suit my
needs perfectly, but the VB Editor does not recognize this
function. Do I need a reference to a particular library or
something?

Thanks in advance for your responses.
- Amos -