PC SOFT

WINDEV的在线文档

  • Differences between the Timer and 系统定时器 functions
  • Process for calling the timer
  • Locking or non-locking operations
  • Execution time of the procedure
  • Timer and sibling windows
  • Timer and Thread
  • Timer and Windows service
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Periodically and automatically calls a WLanguage procedure. Called in the procedure, 系统定时器 is used to identify the timer that started the procedure.

The sequence of periodic calls to a procedure is called timer. This periodic call will be stopped by 结束系统定时器.

WinDev Automatic procedures can be used instead of 系统定时器. See the automatic procedures for more details.

16版本和更高版本
WinDevLinux This function is now available for the WinDev applications in Linux.
16新版本
WinDevLinux This function is now available for the WinDev applications in Linux.
WinDevLinux This function is now available for the WinDev applications in Linux.

18版本和更高版本
WinDevWindows Store apps This function is now available in Windows Store apps mode.
18新版本
WinDevWindows Store apps This function is now available in Windows Store apps mode.
WinDevWindows Store apps This function is now available in Windows Store apps mode.
例子
// Procedure used to display the time in EDT_Time1 on a regular basis
过程Disp_Time()
EDT_Time1系统时间()

// Process when opening the window
// Disp_Time will be automatically called every second
如果系统定时器"Disp_Time"1001)=0,那么
错误"Unable to create the timer"
结束

语法

Starting a procedure periodically 隐藏详细信息

<Result> = 系统定时器(<Procedure Name> , <Frequency> [, <Number>])
<Result>: Integer
  • Number of the opened timer (<Number> if this parameter is specified),
  • 0 if the timer was not opened.
<Procedure Name>: Character string
Name of the WLanguage procedure that must be started periodically.
<Frequency>: Integer
Time (in hundredths of a second) between two calls to the procedure by timer. The precision of the frequency depends on the pending status of the system.
<Number>: Optional integer
Number imposed to the timer. If this parameter is specified, the timer number will be the selected number. If this number corresponds to an existing timer, it will be stopped and replaced by the new timer.

Finding out the timer number 隐藏详细信息

<Result> = 系统定时器()
<Result>: Integer
Number of the timer that called the current procedure.

注意

Differences between the Timer and 系统定时器 functions

  • 定时器 allows you to use a timer managed by WinDev or WinDev Mobile. In this case, the frequency of the call is calculated from the moment when the call to the timer was performed.
  • 系统定时器 allows you to use a timer managed by the system. In this case, the frequency of the call is calculated from the end of the procedure execution.
Tip: In most cases, use 系统定时器.
Indeed, 定时器 consumes more resources than 系统定时器 and it operates only when WinDev/WinDev Mobile windows are displayed (the timer stops if a message box is displayed).

Process for calling the timer

  • Code of the project:
    • If 系统定时器 is called in a code of the project, the timer is associated with the project. The timer is interrupted by 结束系统定时器 and when the execution of the application is ended. The procedure called by the timer must be:
      • a procedure global to the project: 系统定时器 ("<global procedure>", 1000)
      • a static method of a class: 系统定时器("<class>::<static method>", 1000)
    • If 系统定时器 is used in the opening process of the project and if no window is opened, the timer will be valid for the entire project. It is pending and it will be automatically triggered as soon as a window is opened or during the calls to 多任务.
  • Code of a window, control or local procedure:
    If 系统定时器 is called in the code of a window, window control or procedure local to the window, the timer is associated with the window. The timer is est interrupted by 结束系统定时器 and when closing the window. The procedure called by the timer must be:
    • a local procedure of the window: 系统定时器("<local procedure>", 1000)
    • a procedure global to the project: 系统定时器("<global procedure>", 1000)
    • a static method of a class: 系统定时器("<class>::<static method>", 1000)
  • Code of a static method of a class:
    If 系统定时器 is called in a static method of a class, the timer is associated with the class. The timer is interrupted by 结束系统定时器 and when the execution of the application is ended. The procedure called by the timer must be:
    • a static method of the class: 系统定时器 ("::<static method>", 1000)
    • a static method of another class: 系统定时器("<class>::<static method>", 1000)
    • a procedure global to the project: 系统定时器("<global procedure>", 1000)
  • Code of an object method:
    If 系统定时器 is called in a method of an object, the timer is associated with the object. The timer is interrupted by 结束系统定时器, when the object is freed or when closing the window. The procedure called by the timer must be:
    • a non-static method of the object: 系统定时器("<:method>", 1000)
    • a static method of the object class: 系统定时器 ("::<static method>", 1000)
    • a static method of another class: 系统定时器("<class>::<method>", 1000)
    • a procedure global to the project: 系统定时器("<global procedure>", 1000)

Locking or non-locking operations

Execution time of the procedure

If the time used to process the procedure called by the timer is greater than the time requested between each call to the procedure, the calls to the timer do not pile up: there will be a single pending call.

WinDev用户代码(MCU)

Timer and sibling windows

When the same window that manages a timer is opened several times (sibling windows in MDI mode), 系统定时器 must be used with no timer number. Therefore, a timer number will be automatically assigned to each window.

WinDev用户代码(MCU)

Timer and Thread

A procedure started by 定时器 or 系统定时器 from a secondary thread (线程执行) will not be called. Indeed, a secondary thread has no interface (which means no opened window): this secondary thread does not receive the messages from the system (the "message loop") like the main thread of the application.

WinDev

Timer and Windows service

To use 系统定时器 from a Windows service, this function must be called from a window opened by the code of the service.

Caution: This solution is not recommended. To repeat a process from a service, we advise you to call this process from the code of the service (the code of the service being run in loop).

组件
WinDev wd200vm.dll
Linux wd200vm.so