ISCard::get_CardHandle 方法

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

get_CardHandle 方法检索连接的智能卡的句柄。 如果未连接,此方法返回 (*pHandle) == NULL

语法

HRESULT get_CardHandle(
  [out] HSCARD *pHandle
);

parameters

pHandle [out]

指向返回时卡句柄的指针。

返回值

方法返回以下可能值之一。

返回代码 说明
S_OK
操作已成功完成。
E_INVALIDARG
pHandle 参数无效。
E_POINTER
pHandle 中传递了错误的指针。

 

备注

除了上面列出的 COM 错误代码外,如果调用智能卡函数来完成请求,则此接口可能返回智能卡错误代码。 有关详细信息,请参阅 智能卡返回值

示例

以下示例演示如何检索智能卡句柄。

HSCARD   hSC;
HRESULT  hr;

// Retrieve the card handle.
hr = pISCard->get_CardHandle(&hSC);
if (FAILED(hr))
{
   printf("Failed get_CardHandle\n");
   // Take other error handling action as needed.
}
// Use card handle as needed.

要求

要求
最低受支持的客户端
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

另请参阅

get_Atr

get_Context

get_Protocol

get_Status

ISCard