ISCard::AttachByHandle 方法

[ AttachByHandle 方法可用于“要求”部分中指定的操作系统。 它不适用于 Windows Server 2003 Service Pack 1 (SP1) 及更高版本、Windows Vista、Windows Server 2008 和操作系统的后续版本。 智能卡模块提供类似的功能。]

AttachByHandle 方法将 ISCard 对象附加到打开的和配置的智能卡句柄。

语法

HRESULT AttachByHandle(
  [in] HSCARD hCard
);

parameters

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

附加