Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

This function determines if a string contains an emergency phone number.

Syntax

BOOL PhoneIsEmergencyNumber(
 BOOL 
fTailMatchOnly,
 LPCTSTR 
pszNumber,
 LPCTSTR* 
ppszEmergencyNumber
);

Parameters

Term Definition

fTailMatchOnly

[in] If this argument is set to TRUE, the function only attempts to match emergency numbers at the end of pszNumber. If this value is FALSE, the function attempts to match the emergency string exactly with the pszNumberargument.

pszNumber

[in] String to match. If this pointer is NULL or points to an empty string, the function returns FALSE.

ppszEmergencyNumber

[out, optional] On success, constant pointer to the first emergency number matched in pszNumber. On failure, this pointer is undefined. The pointer may be null if the caller was only attempting to match an emergency number rather than return a number. The caller must not free the pointer.

Return Value

Returns TRUE if pszNumbercontains an emergency number; otherwise, FALSE.

Remarks

Local Authentication Plug-ins must be able to place emergency calls at all times. To meet this requirement, a public SDK method is available to determine if a string contains an emergency number. The emergency numbers are gathered from the registry and the Subscriber Identity Module (SIM), if one exists.

Code Example

The code example demonstrates how to use the function.

Note:
To make the code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
Copy Code
#include <phone.h>
TCHAR szString = TEXT("1234911");
LPCTSTR pszReturned;
BOOL fFound;
void main(void)
{
   _tprintf(TEXT("String to be searched: %s\n\n"), szString);
   fFound = PhoneIsEmergencyNumber(FALSE, szString, NULL);
   _tprintf(TEXT("\t%s %s an exact emergency number match.\n"),
	(fFound ? TEXT("is") : TEXT("is not")), szString);
   fFound = PhoneIsEmergencyNumber(TRUE, szString,
&pszReturned);
   if (fFound)
   {
	_tprintf(TEXT("\tFound emergency number %s at tail of %s\n"),
		 pszReturned, szString);
   }
   else
   {
	_tprintf(TEXT("\tNo emergency number found at tail of
%s.\n"),
		 pszReturned, szString);
   }
}

Requirements

Header phone.h
Library phone.lib
Windows Mobile Windows Mobile 6 and later

See Also

Reference

Phone Functions