man_dll.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:31k
源码类别:

MTK

开发平台:

C++ Builder

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *   man_dll.cpp
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   Maui META APP
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   DLL handling source
  48.  *
  49.  * Author:
  50.  * -------
  51.  *  Andy Ueng (mtk00490)
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * $Revision$
  58.  * $Modtime$
  59.  * $Log$
  60.  * 
  61.  *------------------------------------------------------------------------------
  62.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  63.  *============================================================================
  64. ****************************************************************************/
  65. #include <windows.h>
  66. #pragma hdrstop
  67. #include "man_dll.h"
  68. #include "meta_msg.h"
  69. //---------------------------------------------------------------------------
  70. TYPE_age1960_init              function_age1960_init;
  71. TYPE_age1960_reset             function_age1960_reset;
  72. TYPE_age1960_timeOut           function_age1960_timeOut;
  73. TYPE_age1960_amplitudeOffset   function_age1960_amplitudeOffset;
  74. TYPE_age1960_operatingMode     function_age1960_operatingMode;
  75. TYPE_age1960_initMeasFcn       function_age1960_initMeasFcn;
  76. TYPE_age1960_fetchIQTuning_Q   function_age1960_fetchIQTuning_Q;
  77. TYPE_age1960_cellBand          function_age1960_cellBand;
  78. TYPE_age1960_cellPower         function_age1960_cellPower;
  79. TYPE_age1960_BCHARFCN          function_age1960_BCHARFCN;
  80. TYPE_age1960_TCHARFCN          function_age1960_TCHARFCN;
  81. TYPE_age1960_MSTXLevel         function_age1960_MSTXLevel;
  82. TYPE_age1960_readTXPower_Q     function_age1960_readTXPower_Q;
  83. TYPE_age1960_cmd               function_age1960_cmd;
  84. TYPE_age1960_close             function_age1960_close;
  85. TYPE_age1960_waitForInitDone_Q function_age1960_waitForInitDone_Q;
  86. TYPE_age1960_dcl               function_age1960_dcl;
  87. TYPE_age1960_confTXPower       function_age1960_confTXPower;
  88. TYPE_age1960_confPFER          function_age1960_confPFER;
  89. TYPE_age1960_confIQTuning      function_age1960_confIQTuning;
  90. TYPE_age1960_fetchPFER_Q       function_age1960_fetchPFER_Q;
  91. TYPE_age1960_error_message     function_age1960_error_message;
  92. //---------------
  93. // hp663x2
  94. TYPE_hp663x2_init              function_hp663x2_init;
  95. TYPE_hp663x2_close             function_hp663x2_close;
  96. TYPE_hp663x2_outputVoltCurr    function_hp663x2_outputVoltCurr;
  97. TYPE_hp663x2_measureVolt       function_hp663x2_measureVolt;
  98. //hp661x
  99. TYPE_hp661x_init               function_hp661x_init;
  100. TYPE_hp661x_close              function_hp661x_close;
  101. TYPE_hp661x_outputVoltCurr     function_hp661x_outputVoltCurr;
  102. TYPE_hp661x_measureVolt        function_hp661x_measureVolt;
  103. //hpe3631a
  104. TYPE_hpe3631a_init               function_hpe3631a_init;
  105. TYPE_hpe3631a_close              function_hpe3631a_close;
  106. TYPE_hpe3631a_current            function_hpe3631a_current;
  107. TYPE_hpe3631a_voltage            function_hpe3631a_voltage;
  108. TYPE_hpe3631a_measureVoltage_Q   function_hpe3631a_measureVoltage_Q;
  109. // visa32
  110. TYPE_viOpenDefaultRM           function_viOpenDefaultRM;
  111. TYPE_viOpen                    function_viOpen;
  112. TYPE_viClose                   function_viClose;
  113. TYPE_viSetAttribute            function_viSetAttribute;
  114. TYPE_viRead                    function_viRead;
  115. TYPE_viWrite                   function_viWrite;
  116. // Agilent N4010A
  117. TYPE_AgN4010_Init                 function_AgN4010_Init;
  118. TYPE_AgN4010_Close                function_AgN4010_Close;
  119. TYPE_AgN4010_SetProperty          function_AgN4010_SetProperty;
  120. TYPE_AgN4010_Measure_AveragePower function_AgN4010_Measure_AveragePower;
  121. #if 0
  122. // Mfiles
  123. TYPE_InitializeModule_freqz    function_InitializeModule_freqz;
  124. TYPE_InitializeModule_psdoptions   function_InitializeModule_psdoptions;
  125. TYPE_mlxFreqz   function_mlxFreqz;
  126. TYPE_TerminateModule_freqz  function_TerminateModule_freqz;
  127. TYPE_TerminateModule_psdoptions   function_TerminateModule_psdoptions;
  128. TYPE_InitializeModule_firls  function_InitializeModule_firls;
  129. TYPE_InitializeModule_signal_private_firchk  function_InitializeModule_signal_private_firchk;
  130. TYPE_InitializeModule_sinc  function_InitializeModule_sinc;
  131. TYPE_mlxFirls   function_mlxFirls;
  132. TYPE_TerminateModule_sinc   function_TerminateModule_sinc;
  133. TYPE_TerminateModule_signal_private_firchk   function_TerminateModule_signal_private_firchk;
  134. TYPE_TerminateModule_firls   function_TerminateModule_firls;
  135. #endif
  136. //---------------------------------------------------------------------------
  137. CDllMan *DllMan = NULL;
  138. //---------------------------------------------------------------------------
  139. static CDllMan*  dllman_ptr;
  140. //---------------------------------------------------------------------------
  141. //----------------------------------------------------------------------------
  142. //---------------------------------------------------------------------------
  143. //===========================================================================
  144. CDllMan::CDllMan( void )
  145. {
  146.     m_bIsAgeDllLoaded = false;
  147.     m_bIsHp663x2DllLoaded = false;
  148.     m_bIsHp661xDllLoaded = false;
  149.     m_bIsHpe3631aDllLoaded = false;
  150.     m_bIsVisa32Loaded = false;
  151. //    isMfilesLoaded = false;
  152.     m_bIsN4010ADllLoaded = false;
  153.     m_hAgeDll = NULL;
  154.     m_hHp663x2Dll = NULL;
  155.     m_hHp661xDll = NULL;
  156.     m_hHpe3631aDll = NULL;
  157.     m_hVisa32 = NULL;
  158.     m_hN4010ADll = NULL;
  159. }
  160. //---------------------------------------------------------------------------
  161. CDllMan::~CDllMan( )
  162. {
  163. }
  164. //------------------------------------------------------------------------------
  165. bool CDllMan::load_Age1960_Dll_functions( HANDLE hAge1960 )
  166. {
  167.     if (
  168.           ((function_age1960_init = (TYPE_age1960_init)
  169.                           GetProcAddress( hAge1960, "age1960_init")) == NULL) ||
  170.           ((function_age1960_reset = (TYPE_age1960_reset)
  171.                           GetProcAddress( hAge1960, "age1960_reset")) == NULL) ||
  172.           ((function_age1960_timeOut = (TYPE_age1960_timeOut)
  173.                           GetProcAddress( hAge1960, "age1960_timeOut")) == NULL) ||
  174.           ((function_age1960_amplitudeOffset = (TYPE_age1960_amplitudeOffset)
  175.                           GetProcAddress( hAge1960, "age1960_amplitudeOffset")) == NULL) ||
  176.           ((function_age1960_operatingMode = (TYPE_age1960_operatingMode)
  177.                           GetProcAddress( hAge1960, "age1960_operatingMode")) == NULL) ||
  178.           ((function_age1960_initMeasFcn = (TYPE_age1960_initMeasFcn)
  179.                           GetProcAddress( hAge1960, "age1960_initMeasFcn")) == NULL) ||
  180.           ((function_age1960_fetchIQTuning_Q = (TYPE_age1960_fetchIQTuning_Q)
  181.                           GetProcAddress( hAge1960, "age1960_fetchIQTuning_Q")) == NULL) ||
  182.           ((function_age1960_cellBand = (TYPE_age1960_cellBand)
  183.                           GetProcAddress( hAge1960, "age1960_cellBand")) == NULL) ||
  184.           ((function_age1960_cellPower = (TYPE_age1960_cellPower)
  185.                           GetProcAddress( hAge1960, "age1960_cellPower")) == NULL) ||
  186.           ((function_age1960_BCHARFCN = (TYPE_age1960_BCHARFCN)
  187.                           GetProcAddress( hAge1960, "age1960_BCHARFCN")) == NULL) ||
  188.           ((function_age1960_TCHARFCN = (TYPE_age1960_TCHARFCN)
  189.                           GetProcAddress( hAge1960, "age1960_TCHARFCN")) == NULL) ||
  190.           ((function_age1960_MSTXLevel = (TYPE_age1960_MSTXLevel)
  191.                           GetProcAddress( hAge1960, "age1960_MSTXLevel")) == NULL) ||
  192.           ((function_age1960_readTXPower_Q = (TYPE_age1960_readTXPower_Q)
  193.                           GetProcAddress( hAge1960, "age1960_readTXPower_Q")) == NULL) ||
  194.           ((function_age1960_cmd = (TYPE_age1960_cmd)
  195.                           GetProcAddress( hAge1960, "age1960_cmd")) == NULL) ||
  196.           ((function_age1960_close = (TYPE_age1960_close)
  197.                           GetProcAddress( hAge1960, "age1960_close")) == NULL) ||
  198.           // added by Andy Ueng
  199.           ((function_age1960_dcl = (TYPE_age1960_dcl)
  200.                           GetProcAddress( hAge1960, "age1960_dcl")) == NULL) ||
  201.           ((function_age1960_confTXPower = (TYPE_age1960_confTXPower)
  202.                           GetProcAddress( hAge1960, "age1960_confTXPower")) == NULL) ||
  203.            ((function_age1960_confPFER = (TYPE_age1960_confPFER)
  204.                           GetProcAddress( hAge1960, "age1960_confPFER")) == NULL) ||
  205.            ((function_age1960_confIQTuning = (TYPE_age1960_confIQTuning)
  206.                           GetProcAddress( hAge1960, "age1960_confIQTuning")) == NULL) ||
  207.            ((function_age1960_fetchPFER_Q = (TYPE_age1960_fetchPFER_Q)
  208.                           GetProcAddress( hAge1960, "age1960_fetchPFER_Q")) == NULL) ||
  209.            ((function_age1960_error_message = (TYPE_age1960_error_message)
  210.                           GetProcAddress( hAge1960, "age1960_error_message")) == NULL)
  211.           // end of added
  212.        )
  213.     {
  214.        return false;
  215.     }
  216.     return true;
  217. }
  218. //------------------------------------------------------------------------------
  219. bool CDllMan::load_Hp663x2_Dll_functions( HANDLE hHp663x2 )
  220. {
  221.     if (
  222.           ((function_hp663x2_init = (TYPE_hp663x2_init)
  223.                           GetProcAddress( hHp663x2, "hp663x2_init")) == NULL) ||
  224.           ((function_hp663x2_close = (TYPE_hp663x2_close)
  225.                           GetProcAddress( hHp663x2, "hp663x2_close")) == NULL) ||
  226.           ((function_hp663x2_outputVoltCurr = (TYPE_hp663x2_outputVoltCurr)
  227.                           GetProcAddress( hHp663x2, "hp663x2_outputVoltCurr")) == NULL) ||
  228.           ((function_hp663x2_measureVolt = (TYPE_hp663x2_measureVolt)
  229.                           GetProcAddress( hHp663x2, "hp663x2_measureVolt")) == NULL)
  230.        )
  231.     {
  232.        return false;
  233.     }
  234.     return true;
  235.    
  236. }
  237. //------------------------------------------------------------------------------
  238. bool CDllMan::load_Hp661x_Dll_functions( HANDLE hHp661x )
  239. {
  240.     if (
  241.           ((function_hp661x_init = (TYPE_hp661x_init)
  242.                           GetProcAddress( hHp661x, "hp661x_init")) == NULL) ||
  243.           ((function_hp661x_close = (TYPE_hp661x_close)
  244.                           GetProcAddress( hHp661x, "hp661x_close")) == NULL) ||
  245.           ((function_hp661x_outputVoltCurr = (TYPE_hp661x_outputVoltCurr)
  246.                           GetProcAddress( hHp661x, "hp661x_outputVoltCurr")) == NULL) ||
  247.           ((function_hp661x_measureVolt = (TYPE_hp661x_measureVolt)
  248.                           GetProcAddress( hHp661x, "hp661x_measureVolt")) == NULL)
  249.        )
  250.     {
  251.        return false;
  252.     }
  253.     return true;
  254. }
  255. //------------------------------------------------------------------------------
  256. bool CDllMan::load_Hpe3631a_Dll_functions( HANDLE hHpe3631a )
  257. {
  258.     if (
  259.           ((function_hpe3631a_init = (TYPE_hpe3631a_init)
  260.                           GetProcAddress( hHpe3631a, "hpe3631a_init")) == NULL) ||
  261.           ((function_hpe3631a_close = (TYPE_hpe3631a_close)
  262.                           GetProcAddress( hHpe3631a, "hpe3631a_close")) == NULL) ||
  263.           ((function_hpe3631a_current = (TYPE_hpe3631a_current)
  264.                           GetProcAddress( hHpe3631a, "hpe3631a_current")) == NULL) ||
  265.           ((function_hpe3631a_voltage = (TYPE_hpe3631a_voltage)
  266.                           GetProcAddress( hHpe3631a, "hpe3631a_voltage")) == NULL) ||
  267.           ((function_hpe3631a_measureVoltage_Q = (TYPE_hpe3631a_measureVoltage_Q)
  268.                           GetProcAddress( hHpe3631a, "hpe3631a_measureVoltage_Q")) == NULL)
  269.        )
  270.     {
  271.        return false;
  272.     }
  273.     return true;
  274. }
  275. //------------------------------------------------------------------------------
  276. bool CDllMan::load_Visa32_Dll_functions( HANDLE m_hVisa32 )
  277. {
  278.     if(
  279.         ((function_viOpenDefaultRM = (TYPE_viOpenDefaultRM)
  280.                           GetProcAddress( m_hVisa32, "viOpenDefaultRM")) == NULL) ||
  281.         ((function_viOpen = (TYPE_viOpen)
  282.                           GetProcAddress( m_hVisa32, "viOpen")) == NULL) ||
  283.         ((function_viClose = (TYPE_viClose)
  284.                           GetProcAddress( m_hVisa32, "viClose")) == NULL) ||
  285.         ((function_viSetAttribute = (TYPE_viSetAttribute)
  286.                           GetProcAddress( m_hVisa32, "viSetAttribute")) == NULL) ||
  287.         ((function_viRead = (TYPE_viRead)
  288.                           GetProcAddress( m_hVisa32, "viRead")) == NULL) ||
  289.         ((function_viWrite = (TYPE_viWrite)
  290.                           GetProcAddress( m_hVisa32, "viWrite")) == NULL)
  291.         )
  292.     {
  293.         return false;
  294.     }
  295.     return true;
  296. }
  297. //------------------------------------------------------------------------------
  298. bool CDllMan::load_N4010A_Dll_functions( HANDLE hN4010A )
  299. {
  300.     if(
  301.         ((function_AgN4010_Init = (TYPE_AgN4010_Init)
  302.                           GetProcAddress(m_hN4010ADll, "_AgN4010_Init@20")) == NULL) ||
  303.         ((function_AgN4010_Close = (TYPE_AgN4010_Close)
  304.                           GetProcAddress(m_hN4010ADll, "_AgN4010_Close@0")) == NULL) ||
  305.         ((function_AgN4010_SetProperty = (TYPE_AgN4010_SetProperty)
  306.                           GetProcAddress(m_hN4010ADll, "_AgN4010_SetProperty@12")) == NULL) ||
  307.         ((function_AgN4010_Measure_AveragePower = (TYPE_AgN4010_Measure_AveragePower)
  308.                           GetProcAddress(m_hN4010ADll, "_AgN4010_Measure_AveragePower@4")) == NULL)
  309.         )
  310.     {
  311.         return false;
  312.     }
  313.     return true;
  314. }
  315. //------------------------------------------------------------------------------
  316. bool CDllMan::load_Controls_Dll_functions(HANDLE hControls)
  317. {
  318. #if 0
  319.     if(
  320.         ((function_DllCanUnloadNow = (TYPE_DllCanUnloadNow)
  321.                           GetProcAddress(m_hControlsDll, "DllCanUnloadNow")) == NULL) ||
  322.         ((function_DllGetClassObject = (TYPE_DllGetClassObject)
  323.                           GetProcAddress(m_hControlsDll, "DllGetClassObject")) == NULL) ||
  324.         ((function_DllRegisterServer = (TYPE_DllRegisterServer)
  325.                           GetProcAddress(m_hControlsDll, "DllRegisterServer")) == NULL) ||
  326.         ((function_DllUnregisterServer = (TYPE_DllUnregisterServer)
  327.                           GetProcAddress(m_hControlsDll, "DllUnregisterServer")) == NULL)
  328.         )
  329.     {
  330.         return false;
  331.     }
  332. #endif
  333.     //(FARPROC&)lpDllEntryPoint = GetProcAddress(hControls, _T("DllRegisterServer"));
  334.     //if (NULL == lpDllEntryPoint)
  335.    // {
  336.    //     return false;
  337.     //}
  338.     //(*lpDllEntryPoint)();
  339.     return true;
  340. }
  341. #if 0
  342. // R13
  343. //------------------------------------------------------------------------------
  344. bool CDllMan::load_Mfiles_Dll_functions( HANDLE hMfiles )
  345. {
  346.     if(
  347.         ((function_InitializeModule_freqz = (TYPE_InitializeModule_freqz)
  348.                           GetProcAddress( hMfiles, "_InitializeModule_freqz")) == NULL) ||
  349.         ((function_InitializeModule_psdoptions = (TYPE_InitializeModule_psdoptions)
  350.                           GetProcAddress( hMfiles, "_InitializeModule_psdoptions")) == NULL) ||
  351.         ((function_mlxFreqz = (TYPE_mlxFreqz)
  352.                           GetProcAddress( hMfiles, "_mlxFreqz")) == NULL) ||
  353.         ((function_TerminateModule_freqz = (TYPE_TerminateModule_freqz)
  354.                           GetProcAddress( hMfiles, "_TerminateModule_freqz")) == NULL) ||
  355.         ((function_TerminateModule_psdoptions = (TYPE_TerminateModule_psdoptions)
  356.                           GetProcAddress( hMfiles, "_TerminateModule_psdoptions")) == NULL) ||
  357.         ((function_InitializeModule_firls = (TYPE_InitializeModule_firls)
  358.                           GetProcAddress( hMfiles, "_InitializeModule_firls")) == NULL)  ||
  359.         ((function_InitializeModule_signal_private_firchk = (TYPE_InitializeModule_signal_private_firchk)
  360.                           GetProcAddress( hMfiles, "_InitializeModule_signal_private_firchk")) == NULL)  ||
  361.         ((function_InitializeModule_sinc = (TYPE_InitializeModule_sinc)
  362.                           GetProcAddress( hMfiles, "_InitializeModule_sinc")) == NULL)  ||
  363.          ((function_mlxFirls = (TYPE_mlxFirls)
  364.                           GetProcAddress( hMfiles, "_mlxFirls")) == NULL)  ||
  365.          ((function_TerminateModule_sinc = (TYPE_TerminateModule_sinc)
  366.                           GetProcAddress( hMfiles, "_TerminateModule_sinc")) == NULL)  ||
  367.           ((function_TerminateModule_signal_private_firchk = (TYPE_TerminateModule_signal_private_firchk)
  368.                           GetProcAddress( hMfiles, "_TerminateModule_signal_private_firchk")) == NULL)  ||
  369.           ((function_TerminateModule_firls = (TYPE_TerminateModule_firls)
  370.                           GetProcAddress( hMfiles, "_TerminateModule_firls")) == NULL)
  371.         )
  372.     {
  373.         return false;
  374.     }
  375.     return true;
  376. }
  377. #endif
  378. //==============================================================================
  379. bool CDllMan::LoadAge1960DllFunctions( HANDLE hPostMsgDestHandle )
  380. {
  381.     if( m_bIsAgeDllLoaded ) // loaded
  382.     {
  383.         return true;
  384.     }
  385.     m_hAgeDll = LoadLibrary("age1960_32.dll");
  386.     if ( m_hAgeDll == NULL )
  387.     {
  388.          PostMessage( hPostMsgDestHandle,
  389.                       WM_LOAD_AGE1960_DLL_FAILED,
  390.                       0,
  391.                       0
  392.                     );
  393.          return  false;
  394.     }
  395.     else
  396.     {
  397.          if (! load_Age1960_Dll_functions( m_hAgeDll ))
  398.          {
  399.              PostMessage( hPostMsgDestHandle,
  400.                           WM_LOAD_AGE1960_DLL_FUNCTION_FAILED,
  401.                           0,
  402.                           0
  403.                          );
  404.              return  false;
  405.          }
  406.     }
  407.     m_bIsAgeDllLoaded = true;
  408.     return  true;
  409. }
  410. //---------------------------------------------------------------------------
  411. bool CDllMan::FreeAge1960Dll( HANDLE hPostMsgDestHandle )
  412. {
  413.     if( m_bIsAgeDllLoaded == false || m_hAgeDll == NULL )
  414.     {
  415.         return false;
  416.     }
  417.     if( FreeLibrary( m_hAgeDll ) == 0 )
  418.     {
  419.         PostMessage( hPostMsgDestHandle,
  420.                           WM_FREE_AGE1960_DLL_FAILED,
  421.                           0,
  422.                           0
  423.                          );
  424.         return false;
  425.     }
  426.     m_bIsAgeDllLoaded = false;
  427.     m_hAgeDll = NULL;
  428.     return  true;
  429. }
  430. //==============================================================================
  431. bool CDllMan::LoadHp663x2DllFunctions( HANDLE hPostMsgDestHandle )
  432. {
  433.     if( m_bIsHp663x2DllLoaded ) // loaded
  434.     {
  435.         return true;
  436.     }
  437.     m_hHp663x2Dll = LoadLibrary("hp663x2_32.dll");
  438.     if ( m_hHp663x2Dll == NULL )
  439.     {
  440.          PostMessage( hPostMsgDestHandle,
  441.                       WM_LOAD_HP663X2_DLL_FAILED,
  442.                       0,
  443.                       0
  444.                     );
  445.          return  false;
  446.     }
  447.     else
  448.     {
  449.          if (! load_Hp663x2_Dll_functions( m_hHp663x2Dll ))
  450.          {
  451.              PostMessage( hPostMsgDestHandle,
  452.                           WM_LOAD_HP663X2_DLL_FUNCTION_FAILED,
  453.                           0,
  454.                           0
  455.                          );
  456.              return  false;
  457.          }
  458.     }
  459.     m_bIsHp663x2DllLoaded = true;
  460.     return  true;
  461. }
  462. //---------------------------------------------------------------------------
  463. bool CDllMan::FreeHp663x2Dll( HANDLE hPostMsgDestHandle )
  464. {
  465.     if( m_bIsHp663x2DllLoaded == false || m_hHp663x2Dll == NULL )
  466.     {
  467.         return false;
  468.     }
  469.     if( FreeLibrary( m_hHp663x2Dll ) == 0 )
  470.     {
  471.         PostMessage( hPostMsgDestHandle,
  472.                           WM_FREE_HP663X2_DLL_FAILED,
  473.                           0,
  474.                           0
  475.                          );
  476.         return false;
  477.     }
  478.     m_bIsHp663x2DllLoaded = false;
  479.     m_hHp663x2Dll = NULL;
  480.     return  true;
  481. }
  482. //==============================================================================
  483. bool CDllMan::LoadHp661xDllFunctions( HANDLE hPostMsgDestHandle )
  484. {
  485.     if( m_bIsHp661xDllLoaded ) // loaded
  486.     {
  487.         return true;
  488.     }
  489.     m_hHp661xDll = LoadLibrary("hp661x_32.dll");
  490.     if ( m_hHp661xDll == NULL )
  491.     {
  492.          PostMessage( hPostMsgDestHandle,
  493.                       WM_LOAD_HP661X_DLL_FAILED,
  494.                       0,
  495.                       0
  496.                     );
  497.          return  false;
  498.     }
  499.     else
  500.     {
  501.          if (! load_Hp661x_Dll_functions(m_hHp661xDll))
  502.          {
  503.              PostMessage( hPostMsgDestHandle,
  504.                           WM_LOAD_HP661X_DLL_FUNCTION_FAILED,
  505.                           0,
  506.                           0
  507.                          );
  508.              return  false;
  509.          }
  510.     }
  511.     m_bIsHp661xDllLoaded = true;
  512.     return  true;
  513. }
  514. //---------------------------------------------------------------------------
  515. bool CDllMan::FreeHp661xDll( HANDLE hPostMsgDestHandle )
  516. {
  517.     if( m_bIsHp661xDllLoaded == false || m_hHp661xDll == NULL )
  518.     {
  519.         return false;
  520.     }
  521.     if( FreeLibrary( m_hHp661xDll ) == 0 )
  522.     {
  523.         PostMessage( hPostMsgDestHandle,
  524.                           WM_FREE_HP661X_DLL_FAILED,
  525.                           0,
  526.                           0
  527.                          );
  528.         return false;
  529.     }
  530.     m_bIsHp661xDllLoaded = false;
  531.     m_bIsHp661xDllLoaded = NULL;
  532.     return  true;
  533. }
  534. //==============================================================================
  535. bool CDllMan::LoadHpe3631aDllFunctions( HANDLE hPostMsgDestHandle )
  536. {
  537.     if( m_bIsHpe3631aDllLoaded ) // loaded
  538.     {
  539.         return true;
  540.     }
  541.     m_hHpe3631aDll = LoadLibrary("hpe3631a_32.dll");
  542.     if ( m_hHpe3631aDll == NULL )
  543.     {
  544.          PostMessage( hPostMsgDestHandle,
  545.                       WM_LOAD_HPE3631A_DLL_FAILED,
  546.                       0,
  547.                       0
  548.                     );
  549.          return  false;
  550.     }
  551.     else
  552.     {
  553.          if (! load_Hpe3631a_Dll_functions(m_hHpe3631aDll))
  554.          {
  555.              PostMessage( hPostMsgDestHandle,
  556.                           WM_LOAD_HPE3631A_DLL_FUNCTION_FAILED,
  557.                           0,
  558.                           0
  559.                          );
  560.              return  false;
  561.          }
  562.     }
  563.     m_bIsHpe3631aDllLoaded = true;
  564.     return  true;
  565. }
  566. //---------------------------------------------------------------------------
  567. bool CDllMan::FreeHpe3631aDll( HANDLE hPostMsgDestHandle )
  568. {
  569.     if( m_bIsHpe3631aDllLoaded == false || m_hHpe3631aDll == NULL )
  570.     {
  571.         return false;
  572.     }
  573.     if( FreeLibrary( m_hHpe3631aDll ) == 0 )
  574.     {
  575.         PostMessage( hPostMsgDestHandle,
  576.                           WM_FREE_HPE3631A_DLL_FAILED,
  577.                           0,
  578.                           0
  579.                          );
  580.         return false;
  581.     }
  582.     m_bIsHpe3631aDllLoaded = false;
  583.     m_hHpe3631aDll = NULL;
  584.     return  true;
  585. }
  586. //==============================================================================
  587. bool CDllMan::LoadVisa32DllFunctions( HANDLE hPostMsgDestHandle )
  588. {
  589.     if( m_bIsVisa32Loaded ) // loaded
  590.     {
  591.         return true;
  592.     }
  593.     m_hVisa32 = LoadLibrary("visa32.dll");
  594.     if ( m_hVisa32 == NULL )
  595.     {
  596.         PostMessage( hPostMsgDestHandle,
  597.                       WM_LOAD_VISA32_DLL_FAILED,
  598.                       0,
  599.                       0
  600.                     );
  601.         return  false;
  602.     }
  603.     else
  604.     {
  605.          if (! load_Visa32_Dll_functions( m_hVisa32 ))
  606.          {
  607.              PostMessage( hPostMsgDestHandle,
  608.                           WM_LOAD_VISA32_DLL_FUNCTION_FAILED,
  609.                           0,
  610.                           0
  611.                         );
  612.              return false;
  613.          }
  614.     }
  615.     m_bIsVisa32Loaded = true;
  616.     return  true;
  617. }
  618. //---------------------------------------------------------------------------
  619. bool CDllMan::FreeVisa32Dll( HANDLE hPostMsgDestHandle )
  620. {
  621.     if( m_bIsVisa32Loaded == false || m_hVisa32 == NULL )
  622.     {
  623.         return false;
  624.     }
  625.     if( FreeLibrary( m_hVisa32 ) == 0 )
  626.     {
  627.         PostMessage( hPostMsgDestHandle,
  628.                           WM_FREE_VISA32_DLL_FAILED,
  629.                           0,
  630.                           0
  631.                          );
  632.         return false;
  633.     }
  634.     m_bIsVisa32Loaded = false;
  635.     m_hVisa32 = NULL;
  636.     return  true;
  637. }
  638. //==============================================================================
  639. bool CDllMan::LoadN4010ADllFunctions( HANDLE hPostMsgDestHandle )
  640. {
  641.     if( m_bIsN4010ADllLoaded ) // loaded
  642.     {
  643.         return true;
  644.     }
  645.     m_hN4010ADll = LoadLibrary("AgN4010WSODrv.dll");
  646.     if ( NULL == m_hN4010ADll  )
  647.     {
  648.         PostMessage( hPostMsgDestHandle,
  649.                       WM_LOAD_N4010A_DLL_FAILED,
  650.                       0,
  651.                       0
  652.                     );
  653.         return  false;
  654.     }
  655.     else
  656.     {
  657.          if (! load_N4010A_Dll_functions( m_hN4010ADll ))
  658.          {
  659.              PostMessage( hPostMsgDestHandle,
  660.                           WM_LOAD_N4010A_DLL_FUNCTION_FAILED,
  661.                           0,
  662.                           0
  663.                         );
  664.              return false;
  665.          }
  666.     }
  667.     m_bIsN4010ADllLoaded = true;
  668.     return  true;
  669. }
  670. //---------------------------------------------------------------------------
  671. bool CDllMan::FreeN4010ADll( HANDLE hPostMsgDestHandle )
  672. {
  673.     if( !m_bIsN4010ADllLoaded || NULL == m_hN4010ADll )
  674.     {
  675.         return false;
  676.     }
  677.     if( FreeLibrary( m_hN4010ADll ) == 0 )
  678.     {
  679.         PostMessage( hPostMsgDestHandle,
  680.                           WM_FREE_N4010A_DLL_FAILED,
  681.                           0,
  682.                           0
  683.                          );
  684.         return false;
  685.     }
  686.     m_bIsN4010ADllLoaded = false;
  687.     m_hN4010ADll = NULL;
  688.     return  true;
  689. }
  690. //==============================================================================
  691. bool CDllMan::LoadControlsDllFunctions(HANDLE hPostMsgDestHandle)
  692. {
  693.     if (m_bIsControlsDllLoaded) // loaded
  694.     {
  695.         return true;
  696.     }
  697.     m_hControlsDll = LoadLibrary("Controls.dll");
  698.     if (NULL == m_hControlsDll)
  699.     {
  700.         PostMessage(hPostMsgDestHandle,
  701.                       WM_LOAD_CONTROLS_DLL_FAILED,
  702.                       0,
  703.                       0
  704.                     );
  705.         return  false;
  706.     }
  707.     else
  708.     {
  709.          if (!load_Controls_Dll_functions(m_hControlsDll))
  710.          {
  711.              PostMessage( hPostMsgDestHandle,
  712.                           WM_LOAD_CONTROLS_DLL_FUNCTION_FAILED,
  713.                           0,
  714.                           0
  715.                         );
  716.              return false;
  717.          }
  718.     }
  719.     m_bIsControlsDllLoaded = true;
  720.     return  true;
  721. }
  722. //---------------------------------------------------------------------------
  723. bool CDllMan::FreeControlsDll(HANDLE hPostMsgDestHandle)
  724. {
  725.     if (!m_bIsControlsDllLoaded || NULL == m_hControlsDll)
  726.     {
  727.         return false;
  728.     }
  729.     //(FARPROC&)lpDllEntryPoint = GetProcAddress(hControls, _T("DllUnregisterServer"));
  730.     //if (NULL == lpDllEntryPoint)
  731.    // {
  732.     //    return false;
  733.    // }
  734.    // (*lpDllEntryPoint)();
  735.     if (FreeLibrary(m_hControlsDll) == 0)
  736.     {
  737.         PostMessage(hPostMsgDestHandle,
  738.                     WM_FREE_CONTROLS_DLL_FAILED,
  739.                     0,
  740.                     0
  741.                     );
  742.         return false;
  743.     }
  744.     m_bIsControlsDllLoaded = false;
  745.     m_hControlsDll = NULL;
  746.     return  true;
  747. }
  748. #if 0
  749. //==============================================================================
  750. bool CDllMan::LoadMfilesDllFunctions( HANDLE hPostMsgDestHandle )
  751. {
  752.     if( isMfilesLoaded ) // loaded
  753.     {
  754.         return true;
  755.     }
  756.     hMfiles = LoadLibrary("Mfiles.dll");
  757.     if ( hMfiles == NULL )
  758.     {
  759.         PostMessage( hPostMsgDestHandle,
  760.                       WM_LOAD_MFILES_DLL_FAILED,
  761.                       0,
  762.                       0
  763.                     );
  764.         return  false;
  765.     }
  766.     else
  767.     {
  768.          if (! load_Mfiles_Dll_functions( hMfiles ))
  769.          {
  770.              PostMessage( hPostMsgDestHandle,
  771.                           WM_LOAD_MFILES_DLL_FUNCTION_FAILED,
  772.                           0,
  773.                           0
  774.                         );
  775.              return false;
  776.          }
  777.     }
  778.     isMfilesLoaded = true;
  779.     return  true;
  780. }
  781. //---------------------------------------------------------------------------
  782. bool CDllMan::FreeMfilesDll( HANDLE hPostMsgDestHandle )
  783. {
  784.     if( isMfilesLoaded == false || hMfiles == NULL )
  785.     {
  786.         return false;
  787.     }
  788.     if( FreeLibrary( hMfiles ) == 0 )
  789.     {
  790.         PostMessage( hPostMsgDestHandle,
  791.                           WM_FREE_MFILES_DLL_FAILED,
  792.                           0,
  793.                           0
  794.                          );
  795.         return false;
  796.     }
  797.     isMfilesLoaded = false;
  798.     hMfiles = NULL;
  799.     return  true;
  800. }
  801. #endif