共用方式為


ISCard::AttachByHandle 方法

[ AttachByHandle 方法可用於需求一節中指定的作業系統。 它不適用於 Windows Server 2003 Service Pack 1 (SP1) 及更新版本、Windows Vista、Windows Server 2008 和後續版本的作業系統。 智慧卡模組提供類似的功能。]

AttachByHandle方法會將ISCard物件附加至開啟和設定的智慧卡控制碼。

語法

HRESULT AttachByHandle(
  [in] HSCARD hCard
);

參數

hCard [in]

智慧卡開啟連線的控制碼。

傳回值

方法會傳回下列其中一個可能的值。

傳回碼 描述
S_OK
作業順利完成。
E_INVALIDARG
hCard參數無效。

 

備註

除了上面所列的 COM 錯誤碼之外,如果呼叫智慧卡函式以完成要求,此介面可能會傳回智慧卡錯誤碼。 如需詳細資訊,請參閱 智慧卡傳回值

當您完成使用控制碼時,請呼叫 ISCard::D etach 方法來釋放附件。

範例

下列範例顯示附加至智慧卡控制碼。

HRESULT  hr;

// hSC is of type HSCARD and has been previously assigned.
// Attach SCard to the smart card using the value in hSC.
hr = pISCard->AttachByHandle(hSC);
if (FAILED(hr))
{
   printf("Failed AttachByHandle\n");
   // Take other error handling action as needed.
}
// Proceed using attached reader.

規格需求

需求
最低支援的用戶端
Windows XP [僅限傳統型應用程式]
最低支援的伺服器
Windows Server 2003 [僅限桌面應用程式]
用戶端支援結束
Windows XP
伺服器終止支援
Windows Server 2003
標頭
Scardmgr.h
類型程式庫
Scardmgr.tlb
DLL
Scardssp.dll
IID
IID_ISCard定義為 1461AAC3-6810-11D0-918F-00AA00C18068

另請參閱

AttachByReader

分離

get_CardHandle

ISCard

附加