Share via


ICertView::OpenConnection 메서드(certview.h)

OpenConnection 메서드는 인증서 서비스 서버와의 연결을 설정합니다.

구문

HRESULT OpenConnection(
  [in] const BSTR strConfig
);

매개 변수

[in] strConfig

Certificate Services 서버에 대한 유효한 구성 문자열을 나타냅니다. 구성 문자열은 COMPUTERNAME\CANAME 형식이며, 여기서 COMPUTERNAME은 서버의 네트워크 이름이며, CANAME는 인증서 서비스 설정 중에 입력된 인증 기관의 일반 이름입니다. 구성 문자열 이름에 대한 자세한 내용은 ICertConfig를 참조하세요.

반환 값

VB

메서드가 성공하면 메서드는 S_OK 반환합니다.

메서드가 실패하면 오류를 나타내는 HRESULT 값이 반환됩니다. 일반적인 오류 코드 목록은 일반적인 HRESULT 값을 참조하세요.

설명

이 메서드가 성공적으로 완료되면 ICertView 개체는 strConfig 매개 변수에 지정된 Certificate Services 서버에 연결됩니다.

연결을 닫려면 Release 함수를 호출합니다.

예제

ICertView *   pCertView = NULL;
BSTR          strCertServ = NULL;
HRESULT       hr;

// Initialize COM.
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

if (FAILED(hr))
{
    printf("Failed CoInitializeEx\n");
    goto error;
}
// Get pointer to the ICertView interface.
hr = CoCreateInstance(CLSID_CCertView,
                      NULL,
                      CLSCTX_INPROC_SERVER,
                      IID_ICertView,
                      (void **)&pCertView);
if (FAILED(hr))
{
    printf("Failed CoCreateInstance\n");
    goto error;
}
// The use of '\\' is necessary to represent a single backslash.
strCertServ = SysAllocString(TEXT("Server01\\ABCCertServ"));
// Open the connection to the Certificate Services server.
hr = pCertView->OpenConnection(strCertServ);
if (FAILED(hr))
{
    printf("Failed OpenConnection!\n");
    goto error;
}
else
    // Established successful connection; use view as appropriate.
    // ...
    // Done using objects; free resources.
error: 
    if (NULL != pCertView)
        pCertView->Release();
    if (NULL != strCertServ)
        SysFreeString(strCertServ);
    // Free COM resources.
    CoUninitialize();

요구 사항

요구 사항
지원되는 최소 클라이언트 지원되는 버전 없음
지원되는 최소 서버 Windows Server 2003 [데스크톱 앱만 해당]
대상 플랫폼 Windows
헤더 certview.h(Certsrv.h 포함)
라이브러리 Certidl.lib
DLL Certadm.dll

추가 정보

ICertConfig

ICertView

ICertView2

ICertView::OpenView