2015-05-14 112 views
0

有沒有辦法知道代理程序在調試模式下運行(Tools/Debug LotusScript已被激活)?如何測試代理程序在調試中運行?

我在NotesAgent類中找不到任何東西,像RunOnServer但是RunInDebugger。

我需要這個來避免使用位於NNOTESWS.DLL中的進度條函數,它會彈出調試器並禁止任何點擊(進入或監視變量)。順便說一句,如果發生在某人身上,你仍然可以按F8/F5,這至少不會殺死Notes。

回答

2

在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,你將不得不通過每秒鐘的滴答來獲得該值),代碼仍然可以工作,並且完全按照你的要求。

+0

它回答我的問題(即使我得到一個不必要的停止)這是一個負擔得起的解決方案,我可能會使用timer()代替Getthreadinfo。謝謝! –

相關問題