7 Miscellaneous Topics
This chapter includes the following sections:
7.1 System Read Ahead
Outside In uses a technique known as read-ahead in order to cache pages of text in memory for faster display. There are three elements that control this process. If the property SystemReadAhead (see SystemReadAhead) is set to FALSE, then the process which reads and caches the next few pages will be disabled. This means that there could be noticeable delays in the view refresh as the user scrolls through the document. It can also cause unusual scroll bar behavior.
When SystemReadAhead is enabled, the SystemTimer property (see SystemTimer) is a Boolean value that turns all background processing, including read-ahead, on and off. If the SystemTimer property is turned off, read-ahead can be controlled by the programmer by calling the SystemIdle method (see SystemIdle) to allow the viewer to perform background tasks such as read-ahead, caret blinking and auto-scroll.
7.2 Errors
There are two types of errors that can be generated by the ActiveX control. Errors, which occur due to incorrect use of the control, will be caught by the system and will generate an OLE exception. Errors that occur due to invalid parameter content (for example, missing files) will generate an Error event. By default the ErrorShowMsg property (see ErrorShowMsg) is set to TRUE and will display error messages as they occur. The property can be set to FALSE to disable this reporting. In either case, the Error event will be generated.
The Error event handler may access the ErrorCode and ErrorMsg properties (see ErrorCode, and ErrorMsg) to determine the nature of the error. The ErrorMsg is a BSTR variable and can be used to display errors as the developer sees fit.
Private Sub oixctrl1_Error() Rem ** Error event handler for viewer Dim Text As String Select Case oixctrl1.ErrorCode Case SCCERR_ALLOCFAILED: Text = "SCCERR:" + oixctrl1.ErrorMsg Case SCCERR_INSUFFICIENTBUFFER: Text = "SCCERR:" + oixctrl1.ErrorMsg Case SCCERR_MEMORYLEAK: Text = "SCCERR:" + oixctrl1.ErrorMsg Case SCCERR_MEMTABLEFULL: Text = "SCCERR:" + oixctrl1.ErrorMsg End Select MsgBox Text, vbOKOnly, "Outside In Error" End Sub