Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
37 Views

how to use CreateTimerQueueTimer

​hello,

​in order to port some old OpenVms Fortran code I need to create some function to emulate the SYS$SETIMR and its ATS routine callback feature.

​To do that I've found that the use of CreateTimerQueueTimer function of the kernel32 should be ok, but unfortunatly this function is not inside the ifwinty.f90. I've try to create the interface myself but I do not figure out how the do for the type WAITORTIMERCALLBACK.

​So I'm looking of some working sample in fortran of using CreateTimerQueueTimer to set a timer and when timer trig, it's execute the function that it(s pass as parameter.

​thank's

0 Kudos
2 Replies
Highlighted
Valued Contributor I
37 Views

Can't help with CreateTimerQueueTimer().

However, if you have a Win32 program, you can accomplish this (ie, have Windows do something at a specified future time offset) by setting a windows timer which will send a message to a proc function in your code, ie,

! kernalUpdateTime in milliseconds
globalTimer = SetTimer (ghwndMain, 0, kernalUpdateTime, LOC(KernalTimerProc))

!
! Timer callback function for communications kernal. This subroutine
! is called by the communications kernal timer.
!
SUBROUTINE KernalTimerProc (hwnd, uMsg, idEvent, dwTime)
!DEC$ ATTRIBUTES DEFAULT :: KernalTimerProc
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_KernalTimerProc@0' :: KernalTimerProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'KernalTimerProc' :: KernalTimerProc
!DEC$ ENDIF
	IMPLICIT NONE
    INTEGER(HANDLE), INTENT(IN)        :: hwnd
    INTEGER, INTENT(IN)                :: uMsg
    INTEGER, INTENT(IN)                :: idEvent
    INTEGER(DWORD), INTENT(IN)         :: dwTime

...
! and when your program ends, be sure to release the system resources
rval = KillTimer   (ghwndMain, globalTimer)

 

0 Kudos
Highlighted
Beginner
37 Views

thanks for the answer, will see what I can do with this.

regards

0 Kudos