Retrieve tokens for the persistent filters

After your application gets the handle to a filter, your application can retrieve the tokens for that filter.

The tokens can be retrieved by token index.

To get a token from a filter, use the SmsGetToken function. SmsGetToken retrieves the token at the specified index in the filter and writes the token's information into a TOKEN structure.

Example:

// Print all tokens in the hFilter 
// and print the token on the screen.
TOKEN token;
DWORD ctTokens;
DWORD dwLoop;
// Get count of tokens in filter
SmsGetTokenCount (hFilter,  // Handle to filter.
                  &ctTokens // Points to DWORD
                            // to receive count.
                 );
printf("Filter contains %d tokens", ctTokens);
printf("Tokens:\n");
// Loop to get all tokens and display them.
for (dwLoop = 0; dwLoop < ctTokens; dwLoop++) {
  // Clear token.
  memset(&token, 0, sizeof(TOKEN));
  // Get the token.
  stat = SmsGetToken(hFilter,  // Handle to filter.
                     dwLoop,   // Index of the token.
                     &token    // structure for the token data.
                          );
  // Print the display string version of the token.
  printf("%s\n", token.szTokenString);
}

Note that the SmsGetTokenCount function returns the count of tokens within a filter.