FindStringInDoc method

A search is conducted for the text string beginning on the specified page.

Method
short FindStringInDoc(
char * pString,
long page,
short Type,
boolean CaseSensitive,
VARIANT * pFound,
VARIANT * pHorzPosition,
VARIANT * pVertPosition )
Parameters
pString
Points to a null-terminated character string containing the text to be found.
page
Specifies the page on which the search is to begin. If Type specifies ARS_OLE_FIND_PREV or ARS_OLE_FIND_NEXT, the page must be the same as that on which a current find is highlighted.
Type
Specifies the type of find operation. This must be one of the following type values found in ARSOLEEX.H:
  ARS_OLE_FIND_FIRST
  ARS_OLE_FIND_PREV
  ARS_OLE_FIND_NEXT
CaseSensitive
If nonzero, indicates that the search should be case sensitive; if zero, that the case should be ignored.
pFound
Points to a variable to receive a found/not found indication. On return, this variable is set to type VT_I2.
pHorzPosition
Points to a variable to receive the new horizontal scroll position. On return, this variable is set to type VT_I2.
pVertPosition
Points to a variable to receive the new vertical scroll position. On return, this variable is set to type VT_I2.
Description
The variable pointed to by pFound is set to nonzero if the search succeeds; zero if it fails. If the search is successful, the page on which the string is found is made the current page, the string is highlighted and scrolled into view, and the new scroll positions are returned in the specified variables. The scroll positions assume that the scroll ranges have been set to ARS_OLE_SCROLL_RANGE.

The search wraps the document from end to beginning or beginning to end. A previous or next find does not fail. If there is a single occurrence in the document, these will find the same string.

Return Value
Refer to return codes.
See Also
OpenDoc, and UndoFind methods

C/C + +

 CArsOle * pArsCtrl;
 CScrollBar * pHorzScrollBar, * pVertScrollBar;
 VARIANT found, horz_position, vert_position;
 char * pString;
 short rc;
   .
   .
   .

  rc = pArsCtrl->FindStringInDoc( pString,
                                  1,
                                  ARS_OLE_FIND_FIRST,
                                  FALSE,
                                  &found,
                                  &horz_position,
                                  &vert_position );

  if ( rc != ARS_OLE_RC_SUCCESS )
    ERROR;

  if ( found.iVal )
  {
    pHorzScrollBar->SetScrollPos( (int)horz_position.iVal );
    pVertScrollBar->SetScrollPos( (int)vert_position.iVal );

     .
     .
  }
  else
  {
     .
     .
  }

   .
   .

Visual Basic

Dim rc As Integer
Dim found, horz_pos, vert_pos As Variant
Dim Temp As String
 .
 >
 .
rc = ArsOle.FindStringInDoc( Temp,
                             1,
                             ARS_OLE_FIND_FIRST,
                             False,
                             found,
                             horz_pos,
                             vert_pos )
If rc <> ARS_OLE_RC_SUCCESS Then
   MsgBox "ERROR"
   End
End If

If found <> 0 Then
   hScrollBar.Value = horz_pos
   vScrollBar.Value = vert_pos
End If

 .
 .