Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

how to use CreateTimerQueueTimer

charles_d_
Beginner
640 Views

​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
Paul_Curtis
Valued Contributor I
640 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
charles_d_
Beginner
640 Views

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

regards

0 Kudos
Reply