如何测试代理程序在调试中运行?
问题描述:
有没有办法知道代理程序在调试模式下运行(Tools/Debug LotusScript已被激活)?如何测试代理程序在调试中运行?
我在NotesAgent类中找不到任何东西,像RunOnServer但是RunInDebugger。
我需要这个来避免使用位于NNOTESWS.DLL中的进度条函数,它会弹出调试器并禁止任何点击(进入或监视变量)。顺便说一句,如果发生在某人身上,你仍然可以按F8/F5,这至少不会杀死Notes。
答
在OpenNTF中做这件事有一个很好的例子。你可以找到它here。
事实上,它是进度条,所以你可以从那里使用全班。
诀窍是:你添加一个停止语句的函数。您测量停止声明之前和之后的时间。如果时间超过100毫秒,则用户不得不点击“继续”,这是他在这么短的时间内从未做过的事情。如果未启用调试器,停止被忽略 - 无延迟...
这里是连接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个抽动不100ms,你将不得不通过每秒钟的滴答来获得该值),代码仍然可以工作,并且完全按照你的要求。
它回答我的问题(即使我得到一个不必要的停止)这是一个负担得起的解决方案,我可能会使用timer()代替Getthreadinfo。谢谢! –