Platform SDK: Smart Card Enrollment Control

ISCrdEnr::getCertTemplateCount

The getCertTemplateCount method retrieves the number of certificate templates.

objSCEnroll.getCertTemplateCount (dwFlags As Long) As Long

Parameters

objSCEnroll
Object expression that resolves to a SCrdEnr object.
dwFlags
Value that determines if the template is for user or machine certificates. If this value is SCARD_ENROLL_USER_CERT_TEMPLATE (defined as 1) then the returned count will be for user certificate templates. If this value is SCARD_ENROLL_MACHINE_CERT_TEMPLATE (defined as 2) then the returned count will be for machine certificate templates.

Return Values

Long value representing the number of certificate templates.

Example Code in VBScript

' 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

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Library: Included as a resource in Scrdenrl.dll.

See Also

ISCrdEnr::enumCertTemplateName