| Platform SDK: Smart Card Enrollment Control | 
The getCertTemplateCount method retrieves the number of certificate templates.
objSCEnroll.getCertTemplateCount (dwFlags As Long) As Long
Long value representing the number of certificate templates.
' Define the constants.
Const SCARD_ENROLL_USER_CERT_TEMPLATE = 1
Const SCARD_ENROLL_MACHINE_CERT_TEMPLATE = 2
Dim nCount, CertTempType
' Specify the type of certificate template.
CertTempType = SCARD_ENROLL_USER_CERT_TEMPLATE
' Determine the count of Cert Templates.
nCount = Senroll.getCertTemplateCount(CertTempType)
If ( 0 = nCount ) Then
    MsgBox("No certificate templates available.")
Else
    MsgBox("Number of certificate templates: " & nCount )
End If
  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Library: Included as a resource in Scrdenrl.dll.