7.2.3.3 LZNV SDK MFC App File Contents


   7.2.3.3 Function _loadDLL


_loadDLL is a sample function that shows how to work with the LZNV SDK DLL


int32_t CMFCAppClientDlg::_loadDLL()

{

    CString csStrTemp;


    LZNV_DLL_handle = LoadLibrary(LZNV_DLL_Name);


    if (LZNV_DLL_handle == NULL)

    {  

        wchar_t _wchr_current_dir[_MAX_PATH] = {0};

        GetCurrentDirectory(_MAX_PATH, _wchr_current_dir);


        csStrTemp.Format(L"ERROR While Loading Encode DLL %s.\nLastError: %s\nCurrent directory: %s", LZNV_DLL_Name, _getLastErrorString(), _wchr_current_dir);

        m_stStaticLZNV_DLL_Load_Status.SetWindowText(csStrTemp);

       

        MessageBox(csStrTemp, L"Error", IDOK);

        return _LZNV_ERROR_DLL_NOT_FOUND;

    }


    IMPORT_DLL_PROCEDURE_(PF_LZNV_DLL_MAIN_FILE, _p_LZNV_DLL_Main_funct, LZNV_DLL_MAIN_FILE_, L"Successfully found LZNV Main Export function");


    ASSERT(_p_LZNV_DLL_Main_funct);

    if (!_p_LZNV_DLL_Main_funct)

    {

        csStrTemp.Format(L"DLL Main Function not found.");

        m_stStaticLZNV_DLL_Load_Status.SetWindowText(csStrTemp);

        MessageBox(csStrTemp, L"Error", IDOK);

        return _LZNV_ERROR_EXPORTED_MAIN_FUNC_NOT_FOUND;

    }


    m_stStaticLZNV_DLL_Load_Status.SetWindowText(L"LZNV DLL Found. Load Ok!");


    return 0;

}