更新时间:2024-06-28 GMT+08:00
分享

场景12:退出

描述

在第三方APP退出时,需要去初始化SDK,否则名称为HwmSdk.exe的进程(Windows SDK的主进程)一直在后台运行。

业务流程

需要退出SDK时,先调用Exit接口,然后处理回调函数OnExitResult。

  1. 接口调用

    调用Exit退出SDK。

  2. 处理回调函数

    处理回调函数OnExitResult。

示例代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/**
* 退出sdk
*/
void CdemoBeforeLoginDlg::OnBnClickedButtonExit()
{
    int ret = hwmsdkagent::Exit();
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("Exit error"));
    }
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/**
* 退出回调
*/
void demoCallbackProc::OnExitResult(hwmsdk::HwmErrCode ret, const char* msg)
{
    CString codeStr;
    codeStr.Format(_T("%d"), ret);
    string msgStr = CTools::UTF82MultiByte(msg);
    CString tips = _T("OnExitResult code:") + codeStr + _T(", msg:") + CString(msgStr.c_str());
    AfxMessageBox(tips);
}
分享:

    相关文档

    相关产品