메시지가 나타나지 않도록하려면 (예 : 커서를 모래 시계로 변경 한 경우) App.OleRequestPendingTimeout
이 아닌 App.OleServerBusyTimeout
을 사용하고 싶습니다.
선택적으로 App.OLERequestPendingMsgText
을 사용하여 대체 메시지를 설정할 수도 있습니다. 이렇게하면 사용자 지정 메시지가 확인 버튼만으로 사용자에게 표시되므로 혼동이 적습니다. 긴 토론을위한
' set up special message if user interacts with application while waiting on the
' long-running operation to complete
' see http://support.microsoft.com/kb/138066
Dim originalOLEPendingMessage As String
originalOLEPendingMessage = App.OleRequestPendingMsgText
App.OleRequestPendingMsgText = "Please be patient while your request is processed."
Dim originalOLEPendingTimeout as Long
originalOLEPendingTimeout = App.OleRequestPendingTimeout
App.OleRequestPendingTimeout = 10000
On Error GoTo Finally
' Call long-running process here
Finally:
' If an actual error occurred we want to capture all the properties of Err
' so we can re-raise it after we clean up
Dim errNumber As Long
Dim ERRSOURCE As String
Dim errDesc As String
Dim errHelpFile As String
Dim errHelpContext As Long
errNumber = Err.Number
ERRSOURCE = Err.Source
errDesc = Err.Description
errHelpFile = Err.HelpFile
errHelpContext = Err.HelpContext
App.OleRequestPendingMsgText = originalOLEPendingMessage
App.OleRequestPendingTimeout = originalOLEPendingTimeout
If errNumber <> 0 Then
Err.Raise errNumber, ERRSOURCE, errDesc, errHelpFile, errHelpContext
End If
은 Microsoft 기술 자료 문서 How To Handle OLE Automation Server Timeout and Synchronization를 참조하십시오 여기에
은 몇 가지 예제 코드입니다.
VB6 앱에서 IMessageFilter를 구현할 실용적인 방법은 없습니다. 메신저를 쏘는 대신 코드를 수정하는 것이 좋습니다. .NET 코드에서 BackgroundWorker를 사용하고 RunWorkerCompleted 이벤트 처리기에서 이벤트를 발생시켜 VB6 코드에서 작업이 완료되었음을 알립니다. –
+1 한스. 작업자 메소드는 작업 완료를 기다리지 않고 즉시 리턴해야합니다. 그런 다음 작업이 완료되면 GUI에 알리기 위해 이벤트를 발생시킵니다. 또 다른 장점은 GUI가 응답하지 않는 것입니다. – MarkJ