Setting Up the SPLBUFFER Structure
Before you call SplCheck or SplSuggest, set up the SPLBUFFER structure. A SPLBUFFER structure contains a variety of data for the spelling checker functions. First, it contains the input buffer that holds the text that you are checking. It also contains parameters for containing spelling suggestions returned by the spelling checker, the type of spelling error that occurred, where in the input buffer the spelling checker should look next, and how the spelling checker should proceed.
To set up the SPLBUFFER structure for a call to SplCheck
- Set pwzIn to point to the buffer containing the text that you want to check the spelling of.
- Set iwcIn to 0.
The iwcIn member contains the offset for where SplCheck begins searching for misspelled words. Setting iwcIn to 0 causes SplCheck to begin searching at the beginning of the input buffer.
- Set cwcIn to the size of the input buffer relative to pwzIn.
- Set dwMode to SPL_NO_STATE_INFO or SPL_STARTS_SENTENCE.
- Use SPL_NO_STATE_INFO if you do not know anything about the contents of the input buffer.
- Use SPL_STARTS_SENTENCE if you know that the input buffer contains text that starts at the beginning of a sentence.
- Set dwErr to receive an error code from SplCheck.
SplCheck places the results of the spelling session in dwErr.
- Set iwcErr to receive the index of the location of the spelling error, if such an error exists.
- Set cwcErr to receive the length of the word containing the spelling error, if such an error exists.