PC SOFT

WINDEV的在线文档

  • Overview
  • How do I proceed?
  • Displaying the information
  • Managing the display of the debug information
  • Creating a trace file
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系: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本地访问

Overview
In some cases, running a program or a site with or without the debugger can produce different results.

Indeed, the debugger introduces pauses in the execution of the process during which several tasks are performed by WinDev.

Therefore, the debugger cannot be used in a procedure called by timer or in the code of a scrollbar.

To debug these applications, you may want to follow the evolution of a value, how different procedures are called, ...

How do I proceed?

Displaying the information

Two tools can be used to display the information:
  • The information boxes: WLanguage 信息 function. Caution: Displaying an information box is a locking operation.
  • The trace window: WLanguage 跟踪 function.
The trace window is displayed in the top left corner of the screen, without interrupting the program execution. If can also be displayed it in the interface via the "Trace of debugger" pane.

Managing the display of the debug information

Displaying the debug information on the screen is useful in test mode only.

Any unsuitable display must be removed before distributing an application.

To avoid any oversight, we advise you to manage the display of the debug information via a global procedure. For example:

过程MyTraceStringToTrace
如果模式为测试()=,那么
跟踪StringToTrace
结束

In this code, depending on the result of 模式为测试, the trace window appears when running the application test or the site test.

Such procedure enables you to leave the call to the trace windows in the code of the application without any risk of displaying it on the end-user computers.

The call to this trace procedure is identical to the use of 跟踪:

MyTrace"Customer: "+Customer.CustomerNum

Creating a trace file

During long processes (batch processes, ...), to check how the program is running, you must keep a physical trace of the processes performed (a text file for example).

The following procedure is used to manage the display of the trace:

  • On the screen (/DEBUG parameter in command line).
  • In a text file (default mode).
过程MyTraceStringToTrace
FilePath字符串型
FilePath文件用户数据目录()+项目信息项目信息.项目名称)+".txt"
FileNum整数型
DebugMode布尔型
如果位置命令行(),"/DEBUG")大于0,那么
DebugMode
结束
如果DebugMode,那么
跟踪StringToTrace
否则
FileNum文件打开FilePath文件打开.不存在则创建+文件打开.+文件打开.添加
如果FileNum不等于-1,那么
DateTimeTrace日期时间型系统日期时间()
DateTrace字符串型MyDate..日期部分
TimeTrace时间型MyDate..时间部分
文件写一行FileNum日期转换为字符串DateTrace)+...
" - "+时间转换为字符串TimeTrace))
文件写一行FileNumStringToTrace
文件写一行FileNum" "
文件关闭FileNum
结束
结束

Notes:

  • The trace file is created by default in the data directory of the user. This file is named like the project. This file contains the information to trace during the program execution. The information is completed by the date and time of each "Trace". This allows you to detect a potential problem during the process.
  • Example of content of trace file:
01/12/2001 - 10:53:25:20
Customer name: Martin
01/12/2001 - 10:53:25:26
Customer name: Mirva