如何测试该代理 运行 In Debug?
How to test that agent is running In Debug?
有没有办法知道 运行 中的代理处于调试模式(Tools/Debug LotusScript 已被激活)?
我在 NotesAgent class 中什么也没找到,类似于 RunOnServer 但 RunInDebugger。
我需要这个来避免使用位于 NNOTESWS.DLL 中的进度条功能,它会弹出调试器并禁止任何点击(单步执行或观察变量)。顺便说一句,如果有人遇到这种情况,您仍然可以按 F8 / F5,这至少不会杀死 Notes。
在 OpenNTF 中有一个很好的例子可以做到这一点。你可以找到它 here.
实际上它是用于进度条的,因此您可以从那里使用整个 class。
诀窍是:添加一个带有停止语句的函数。您测量停止语句之前和之后的时间。如果经过的时间大于 100 毫秒,则用户必须单击 "continue",这是他在如此短的时间内从未设法完成的事情。如果未启用调试器,则忽略停止 - 无延迟...
这是链接的 openntf 文章中使用的函数:
Public Function IsDebugMode() As Boolean
Dim start As Variant
start = Getthreadinfo(6) ' LSI_THREAD_TICKS
Stop
If Getthreadinfo(6) - start > 100 Then IsDebugMode = True
' If you debug the application you will not be able to press the CONTINUE-Buton
' within less then 100 milliseconds, otherwise the STOP-statement is not in function
' and you will always be quicker then 100 milliseconds
End Function
尽管评论实际上是错误的(100 次抽动不是 100 毫秒,您必须按每秒抽动次数进行除法才能获得该值),但代码仍然有效并且完全符合您的要求。
有没有办法知道 运行 中的代理处于调试模式(Tools/Debug LotusScript 已被激活)?
我在 NotesAgent class 中什么也没找到,类似于 RunOnServer 但 RunInDebugger。
我需要这个来避免使用位于 NNOTESWS.DLL 中的进度条功能,它会弹出调试器并禁止任何点击(单步执行或观察变量)。顺便说一句,如果有人遇到这种情况,您仍然可以按 F8 / F5,这至少不会杀死 Notes。
在 OpenNTF 中有一个很好的例子可以做到这一点。你可以找到它 here.
实际上它是用于进度条的,因此您可以从那里使用整个 class。
诀窍是:添加一个带有停止语句的函数。您测量停止语句之前和之后的时间。如果经过的时间大于 100 毫秒,则用户必须单击 "continue",这是他在如此短的时间内从未设法完成的事情。如果未启用调试器,则忽略停止 - 无延迟...
这是链接的 openntf 文章中使用的函数:
Public Function IsDebugMode() As Boolean
Dim start As Variant
start = Getthreadinfo(6) ' LSI_THREAD_TICKS
Stop
If Getthreadinfo(6) - start > 100 Then IsDebugMode = True
' If you debug the application you will not be able to press the CONTINUE-Buton
' within less then 100 milliseconds, otherwise the STOP-statement is not in function
' and you will always be quicker then 100 milliseconds
End Function
尽管评论实际上是错误的(100 次抽动不是 100 毫秒,您必须按每秒抽动次数进行除法才能获得该值),但代码仍然有效并且完全符合您的要求。