man_dll.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:31k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * man_dll.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * DLL handling source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #include <windows.h>
- #pragma hdrstop
- #include "man_dll.h"
- #include "meta_msg.h"
- //---------------------------------------------------------------------------
- TYPE_age1960_init function_age1960_init;
- TYPE_age1960_reset function_age1960_reset;
- TYPE_age1960_timeOut function_age1960_timeOut;
- TYPE_age1960_amplitudeOffset function_age1960_amplitudeOffset;
- TYPE_age1960_operatingMode function_age1960_operatingMode;
- TYPE_age1960_initMeasFcn function_age1960_initMeasFcn;
- TYPE_age1960_fetchIQTuning_Q function_age1960_fetchIQTuning_Q;
- TYPE_age1960_cellBand function_age1960_cellBand;
- TYPE_age1960_cellPower function_age1960_cellPower;
- TYPE_age1960_BCHARFCN function_age1960_BCHARFCN;
- TYPE_age1960_TCHARFCN function_age1960_TCHARFCN;
- TYPE_age1960_MSTXLevel function_age1960_MSTXLevel;
- TYPE_age1960_readTXPower_Q function_age1960_readTXPower_Q;
- TYPE_age1960_cmd function_age1960_cmd;
- TYPE_age1960_close function_age1960_close;
- TYPE_age1960_waitForInitDone_Q function_age1960_waitForInitDone_Q;
- TYPE_age1960_dcl function_age1960_dcl;
- TYPE_age1960_confTXPower function_age1960_confTXPower;
- TYPE_age1960_confPFER function_age1960_confPFER;
- TYPE_age1960_confIQTuning function_age1960_confIQTuning;
- TYPE_age1960_fetchPFER_Q function_age1960_fetchPFER_Q;
- TYPE_age1960_error_message function_age1960_error_message;
- //---------------
- // hp663x2
- TYPE_hp663x2_init function_hp663x2_init;
- TYPE_hp663x2_close function_hp663x2_close;
- TYPE_hp663x2_outputVoltCurr function_hp663x2_outputVoltCurr;
- TYPE_hp663x2_measureVolt function_hp663x2_measureVolt;
- //hp661x
- TYPE_hp661x_init function_hp661x_init;
- TYPE_hp661x_close function_hp661x_close;
- TYPE_hp661x_outputVoltCurr function_hp661x_outputVoltCurr;
- TYPE_hp661x_measureVolt function_hp661x_measureVolt;
- //hpe3631a
- TYPE_hpe3631a_init function_hpe3631a_init;
- TYPE_hpe3631a_close function_hpe3631a_close;
- TYPE_hpe3631a_current function_hpe3631a_current;
- TYPE_hpe3631a_voltage function_hpe3631a_voltage;
- TYPE_hpe3631a_measureVoltage_Q function_hpe3631a_measureVoltage_Q;
- // visa32
- TYPE_viOpenDefaultRM function_viOpenDefaultRM;
- TYPE_viOpen function_viOpen;
- TYPE_viClose function_viClose;
- TYPE_viSetAttribute function_viSetAttribute;
- TYPE_viRead function_viRead;
- TYPE_viWrite function_viWrite;
- // Agilent N4010A
- TYPE_AgN4010_Init function_AgN4010_Init;
- TYPE_AgN4010_Close function_AgN4010_Close;
- TYPE_AgN4010_SetProperty function_AgN4010_SetProperty;
- TYPE_AgN4010_Measure_AveragePower function_AgN4010_Measure_AveragePower;
- #if 0
- // Mfiles
- TYPE_InitializeModule_freqz function_InitializeModule_freqz;
- TYPE_InitializeModule_psdoptions function_InitializeModule_psdoptions;
- TYPE_mlxFreqz function_mlxFreqz;
- TYPE_TerminateModule_freqz function_TerminateModule_freqz;
- TYPE_TerminateModule_psdoptions function_TerminateModule_psdoptions;
- TYPE_InitializeModule_firls function_InitializeModule_firls;
- TYPE_InitializeModule_signal_private_firchk function_InitializeModule_signal_private_firchk;
- TYPE_InitializeModule_sinc function_InitializeModule_sinc;
- TYPE_mlxFirls function_mlxFirls;
- TYPE_TerminateModule_sinc function_TerminateModule_sinc;
- TYPE_TerminateModule_signal_private_firchk function_TerminateModule_signal_private_firchk;
- TYPE_TerminateModule_firls function_TerminateModule_firls;
- #endif
- //---------------------------------------------------------------------------
- CDllMan *DllMan = NULL;
- //---------------------------------------------------------------------------
- static CDllMan* dllman_ptr;
- //---------------------------------------------------------------------------
- //----------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- //===========================================================================
- CDllMan::CDllMan( void )
- {
- m_bIsAgeDllLoaded = false;
- m_bIsHp663x2DllLoaded = false;
- m_bIsHp661xDllLoaded = false;
- m_bIsHpe3631aDllLoaded = false;
- m_bIsVisa32Loaded = false;
- // isMfilesLoaded = false;
- m_bIsN4010ADllLoaded = false;
- m_hAgeDll = NULL;
- m_hHp663x2Dll = NULL;
- m_hHp661xDll = NULL;
- m_hHpe3631aDll = NULL;
- m_hVisa32 = NULL;
- m_hN4010ADll = NULL;
- }
- //---------------------------------------------------------------------------
- CDllMan::~CDllMan( )
- {
- }
- //------------------------------------------------------------------------------
- bool CDllMan::load_Age1960_Dll_functions( HANDLE hAge1960 )
- {
- if (
- ((function_age1960_init = (TYPE_age1960_init)
- GetProcAddress( hAge1960, "age1960_init")) == NULL) ||
- ((function_age1960_reset = (TYPE_age1960_reset)
- GetProcAddress( hAge1960, "age1960_reset")) == NULL) ||
- ((function_age1960_timeOut = (TYPE_age1960_timeOut)
- GetProcAddress( hAge1960, "age1960_timeOut")) == NULL) ||
- ((function_age1960_amplitudeOffset = (TYPE_age1960_amplitudeOffset)
- GetProcAddress( hAge1960, "age1960_amplitudeOffset")) == NULL) ||
- ((function_age1960_operatingMode = (TYPE_age1960_operatingMode)
- GetProcAddress( hAge1960, "age1960_operatingMode")) == NULL) ||
- ((function_age1960_initMeasFcn = (TYPE_age1960_initMeasFcn)
- GetProcAddress( hAge1960, "age1960_initMeasFcn")) == NULL) ||
- ((function_age1960_fetchIQTuning_Q = (TYPE_age1960_fetchIQTuning_Q)
- GetProcAddress( hAge1960, "age1960_fetchIQTuning_Q")) == NULL) ||
- ((function_age1960_cellBand = (TYPE_age1960_cellBand)
- GetProcAddress( hAge1960, "age1960_cellBand")) == NULL) ||
- ((function_age1960_cellPower = (TYPE_age1960_cellPower)
- GetProcAddress( hAge1960, "age1960_cellPower")) == NULL) ||
- ((function_age1960_BCHARFCN = (TYPE_age1960_BCHARFCN)
- GetProcAddress( hAge1960, "age1960_BCHARFCN")) == NULL) ||
- ((function_age1960_TCHARFCN = (TYPE_age1960_TCHARFCN)
- GetProcAddress( hAge1960, "age1960_TCHARFCN")) == NULL) ||
- ((function_age1960_MSTXLevel = (TYPE_age1960_MSTXLevel)
- GetProcAddress( hAge1960, "age1960_MSTXLevel")) == NULL) ||
- ((function_age1960_readTXPower_Q = (TYPE_age1960_readTXPower_Q)
- GetProcAddress( hAge1960, "age1960_readTXPower_Q")) == NULL) ||
- ((function_age1960_cmd = (TYPE_age1960_cmd)
- GetProcAddress( hAge1960, "age1960_cmd")) == NULL) ||
- ((function_age1960_close = (TYPE_age1960_close)
- GetProcAddress( hAge1960, "age1960_close")) == NULL) ||
- // added by Andy Ueng
- ((function_age1960_dcl = (TYPE_age1960_dcl)
- GetProcAddress( hAge1960, "age1960_dcl")) == NULL) ||
- ((function_age1960_confTXPower = (TYPE_age1960_confTXPower)
- GetProcAddress( hAge1960, "age1960_confTXPower")) == NULL) ||
- ((function_age1960_confPFER = (TYPE_age1960_confPFER)
- GetProcAddress( hAge1960, "age1960_confPFER")) == NULL) ||
- ((function_age1960_confIQTuning = (TYPE_age1960_confIQTuning)
- GetProcAddress( hAge1960, "age1960_confIQTuning")) == NULL) ||
- ((function_age1960_fetchPFER_Q = (TYPE_age1960_fetchPFER_Q)
- GetProcAddress( hAge1960, "age1960_fetchPFER_Q")) == NULL) ||
- ((function_age1960_error_message = (TYPE_age1960_error_message)
- GetProcAddress( hAge1960, "age1960_error_message")) == NULL)
- // end of added
- )
- {
- return false;
- }
- return true;
- }
- //------------------------------------------------------------------------------
- bool CDllMan::load_Hp663x2_Dll_functions( HANDLE hHp663x2 )
- {
- if (
- ((function_hp663x2_init = (TYPE_hp663x2_init)
- GetProcAddress( hHp663x2, "hp663x2_init")) == NULL) ||
- ((function_hp663x2_close = (TYPE_hp663x2_close)
- GetProcAddress( hHp663x2, "hp663x2_close")) == NULL) ||
- ((function_hp663x2_outputVoltCurr = (TYPE_hp663x2_outputVoltCurr)
- GetProcAddress( hHp663x2, "hp663x2_outputVoltCurr")) == NULL) ||
- ((function_hp663x2_measureVolt = (TYPE_hp663x2_measureVolt)
- GetProcAddress( hHp663x2, "hp663x2_measureVolt")) == NULL)
- )
- {
- return false;
- }
- return true;
-
- }
- //------------------------------------------------------------------------------
- bool CDllMan::load_Hp661x_Dll_functions( HANDLE hHp661x )
- {
- if (
- ((function_hp661x_init = (TYPE_hp661x_init)
- GetProcAddress( hHp661x, "hp661x_init")) == NULL) ||
- ((function_hp661x_close = (TYPE_hp661x_close)
- GetProcAddress( hHp661x, "hp661x_close")) == NULL) ||
- ((function_hp661x_outputVoltCurr = (TYPE_hp661x_outputVoltCurr)
- GetProcAddress( hHp661x, "hp661x_outputVoltCurr")) == NULL) ||
- ((function_hp661x_measureVolt = (TYPE_hp661x_measureVolt)
- GetProcAddress( hHp661x, "hp661x_measureVolt")) == NULL)
- )
- {
- return false;
- }
- return true;
- }
- //------------------------------------------------------------------------------
- bool CDllMan::load_Hpe3631a_Dll_functions( HANDLE hHpe3631a )
- {
- if (
- ((function_hpe3631a_init = (TYPE_hpe3631a_init)
- GetProcAddress( hHpe3631a, "hpe3631a_init")) == NULL) ||
- ((function_hpe3631a_close = (TYPE_hpe3631a_close)
- GetProcAddress( hHpe3631a, "hpe3631a_close")) == NULL) ||
- ((function_hpe3631a_current = (TYPE_hpe3631a_current)
- GetProcAddress( hHpe3631a, "hpe3631a_current")) == NULL) ||
- ((function_hpe3631a_voltage = (TYPE_hpe3631a_voltage)
- GetProcAddress( hHpe3631a, "hpe3631a_voltage")) == NULL) ||
- ((function_hpe3631a_measureVoltage_Q = (TYPE_hpe3631a_measureVoltage_Q)
- GetProcAddress( hHpe3631a, "hpe3631a_measureVoltage_Q")) == NULL)
- )
- {
- return false;
- }
- return true;
- }
- //------------------------------------------------------------------------------
- bool CDllMan::load_Visa32_Dll_functions( HANDLE m_hVisa32 )
- {
- if(
- ((function_viOpenDefaultRM = (TYPE_viOpenDefaultRM)
- GetProcAddress( m_hVisa32, "viOpenDefaultRM")) == NULL) ||
- ((function_viOpen = (TYPE_viOpen)
- GetProcAddress( m_hVisa32, "viOpen")) == NULL) ||
- ((function_viClose = (TYPE_viClose)
- GetProcAddress( m_hVisa32, "viClose")) == NULL) ||
- ((function_viSetAttribute = (TYPE_viSetAttribute)
- GetProcAddress( m_hVisa32, "viSetAttribute")) == NULL) ||
- ((function_viRead = (TYPE_viRead)
- GetProcAddress( m_hVisa32, "viRead")) == NULL) ||
- ((function_viWrite = (TYPE_viWrite)
- GetProcAddress( m_hVisa32, "viWrite")) == NULL)
- )
- {
- return false;
- }
- return true;
- }
- //------------------------------------------------------------------------------
- bool CDllMan::load_N4010A_Dll_functions( HANDLE hN4010A )
- {
- if(
- ((function_AgN4010_Init = (TYPE_AgN4010_Init)
- GetProcAddress(m_hN4010ADll, "_AgN4010_Init@20")) == NULL) ||
- ((function_AgN4010_Close = (TYPE_AgN4010_Close)
- GetProcAddress(m_hN4010ADll, "_AgN4010_Close@0")) == NULL) ||
- ((function_AgN4010_SetProperty = (TYPE_AgN4010_SetProperty)
- GetProcAddress(m_hN4010ADll, "_AgN4010_SetProperty@12")) == NULL) ||
- ((function_AgN4010_Measure_AveragePower = (TYPE_AgN4010_Measure_AveragePower)
- GetProcAddress(m_hN4010ADll, "_AgN4010_Measure_AveragePower@4")) == NULL)
- )
- {
- return false;
- }
- return true;
- }
- //------------------------------------------------------------------------------
- bool CDllMan::load_Controls_Dll_functions(HANDLE hControls)
- {
- #if 0
- if(
- ((function_DllCanUnloadNow = (TYPE_DllCanUnloadNow)
- GetProcAddress(m_hControlsDll, "DllCanUnloadNow")) == NULL) ||
- ((function_DllGetClassObject = (TYPE_DllGetClassObject)
- GetProcAddress(m_hControlsDll, "DllGetClassObject")) == NULL) ||
- ((function_DllRegisterServer = (TYPE_DllRegisterServer)
- GetProcAddress(m_hControlsDll, "DllRegisterServer")) == NULL) ||
- ((function_DllUnregisterServer = (TYPE_DllUnregisterServer)
- GetProcAddress(m_hControlsDll, "DllUnregisterServer")) == NULL)
- )
- {
- return false;
- }
- #endif
- //(FARPROC&)lpDllEntryPoint = GetProcAddress(hControls, _T("DllRegisterServer"));
- //if (NULL == lpDllEntryPoint)
- // {
- // return false;
- //}
- //(*lpDllEntryPoint)();
- return true;
- }
- #if 0
- // R13
- //------------------------------------------------------------------------------
- bool CDllMan::load_Mfiles_Dll_functions( HANDLE hMfiles )
- {
- if(
- ((function_InitializeModule_freqz = (TYPE_InitializeModule_freqz)
- GetProcAddress( hMfiles, "_InitializeModule_freqz")) == NULL) ||
- ((function_InitializeModule_psdoptions = (TYPE_InitializeModule_psdoptions)
- GetProcAddress( hMfiles, "_InitializeModule_psdoptions")) == NULL) ||
- ((function_mlxFreqz = (TYPE_mlxFreqz)
- GetProcAddress( hMfiles, "_mlxFreqz")) == NULL) ||
- ((function_TerminateModule_freqz = (TYPE_TerminateModule_freqz)
- GetProcAddress( hMfiles, "_TerminateModule_freqz")) == NULL) ||
- ((function_TerminateModule_psdoptions = (TYPE_TerminateModule_psdoptions)
- GetProcAddress( hMfiles, "_TerminateModule_psdoptions")) == NULL) ||
- ((function_InitializeModule_firls = (TYPE_InitializeModule_firls)
- GetProcAddress( hMfiles, "_InitializeModule_firls")) == NULL) ||
- ((function_InitializeModule_signal_private_firchk = (TYPE_InitializeModule_signal_private_firchk)
- GetProcAddress( hMfiles, "_InitializeModule_signal_private_firchk")) == NULL) ||
- ((function_InitializeModule_sinc = (TYPE_InitializeModule_sinc)
- GetProcAddress( hMfiles, "_InitializeModule_sinc")) == NULL) ||
- ((function_mlxFirls = (TYPE_mlxFirls)
- GetProcAddress( hMfiles, "_mlxFirls")) == NULL) ||
- ((function_TerminateModule_sinc = (TYPE_TerminateModule_sinc)
- GetProcAddress( hMfiles, "_TerminateModule_sinc")) == NULL) ||
- ((function_TerminateModule_signal_private_firchk = (TYPE_TerminateModule_signal_private_firchk)
- GetProcAddress( hMfiles, "_TerminateModule_signal_private_firchk")) == NULL) ||
- ((function_TerminateModule_firls = (TYPE_TerminateModule_firls)
- GetProcAddress( hMfiles, "_TerminateModule_firls")) == NULL)
- )
- {
- return false;
- }
- return true;
- }
- #endif
- //==============================================================================
- bool CDllMan::LoadAge1960DllFunctions( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsAgeDllLoaded ) // loaded
- {
- return true;
- }
- m_hAgeDll = LoadLibrary("age1960_32.dll");
- if ( m_hAgeDll == NULL )
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_AGE1960_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (! load_Age1960_Dll_functions( m_hAgeDll ))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_AGE1960_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- m_bIsAgeDllLoaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeAge1960Dll( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsAgeDllLoaded == false || m_hAgeDll == NULL )
- {
- return false;
- }
- if( FreeLibrary( m_hAgeDll ) == 0 )
- {
- PostMessage( hPostMsgDestHandle,
- WM_FREE_AGE1960_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- m_bIsAgeDllLoaded = false;
- m_hAgeDll = NULL;
- return true;
- }
- //==============================================================================
- bool CDllMan::LoadHp663x2DllFunctions( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsHp663x2DllLoaded ) // loaded
- {
- return true;
- }
- m_hHp663x2Dll = LoadLibrary("hp663x2_32.dll");
- if ( m_hHp663x2Dll == NULL )
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_HP663X2_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (! load_Hp663x2_Dll_functions( m_hHp663x2Dll ))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_HP663X2_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- m_bIsHp663x2DllLoaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeHp663x2Dll( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsHp663x2DllLoaded == false || m_hHp663x2Dll == NULL )
- {
- return false;
- }
- if( FreeLibrary( m_hHp663x2Dll ) == 0 )
- {
- PostMessage( hPostMsgDestHandle,
- WM_FREE_HP663X2_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- m_bIsHp663x2DllLoaded = false;
- m_hHp663x2Dll = NULL;
- return true;
- }
- //==============================================================================
- bool CDllMan::LoadHp661xDllFunctions( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsHp661xDllLoaded ) // loaded
- {
- return true;
- }
- m_hHp661xDll = LoadLibrary("hp661x_32.dll");
- if ( m_hHp661xDll == NULL )
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_HP661X_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (! load_Hp661x_Dll_functions(m_hHp661xDll))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_HP661X_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- m_bIsHp661xDllLoaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeHp661xDll( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsHp661xDllLoaded == false || m_hHp661xDll == NULL )
- {
- return false;
- }
- if( FreeLibrary( m_hHp661xDll ) == 0 )
- {
- PostMessage( hPostMsgDestHandle,
- WM_FREE_HP661X_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- m_bIsHp661xDllLoaded = false;
- m_bIsHp661xDllLoaded = NULL;
- return true;
- }
- //==============================================================================
- bool CDllMan::LoadHpe3631aDllFunctions( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsHpe3631aDllLoaded ) // loaded
- {
- return true;
- }
- m_hHpe3631aDll = LoadLibrary("hpe3631a_32.dll");
- if ( m_hHpe3631aDll == NULL )
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_HPE3631A_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (! load_Hpe3631a_Dll_functions(m_hHpe3631aDll))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_HPE3631A_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- m_bIsHpe3631aDllLoaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeHpe3631aDll( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsHpe3631aDllLoaded == false || m_hHpe3631aDll == NULL )
- {
- return false;
- }
- if( FreeLibrary( m_hHpe3631aDll ) == 0 )
- {
- PostMessage( hPostMsgDestHandle,
- WM_FREE_HPE3631A_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- m_bIsHpe3631aDllLoaded = false;
- m_hHpe3631aDll = NULL;
- return true;
- }
- //==============================================================================
- bool CDllMan::LoadVisa32DllFunctions( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsVisa32Loaded ) // loaded
- {
- return true;
- }
- m_hVisa32 = LoadLibrary("visa32.dll");
- if ( m_hVisa32 == NULL )
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_VISA32_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (! load_Visa32_Dll_functions( m_hVisa32 ))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_VISA32_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- m_bIsVisa32Loaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeVisa32Dll( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsVisa32Loaded == false || m_hVisa32 == NULL )
- {
- return false;
- }
- if( FreeLibrary( m_hVisa32 ) == 0 )
- {
- PostMessage( hPostMsgDestHandle,
- WM_FREE_VISA32_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- m_bIsVisa32Loaded = false;
- m_hVisa32 = NULL;
- return true;
- }
- //==============================================================================
- bool CDllMan::LoadN4010ADllFunctions( HANDLE hPostMsgDestHandle )
- {
- if( m_bIsN4010ADllLoaded ) // loaded
- {
- return true;
- }
- m_hN4010ADll = LoadLibrary("AgN4010WSODrv.dll");
- if ( NULL == m_hN4010ADll )
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_N4010A_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (! load_N4010A_Dll_functions( m_hN4010ADll ))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_N4010A_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- m_bIsN4010ADllLoaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeN4010ADll( HANDLE hPostMsgDestHandle )
- {
- if( !m_bIsN4010ADllLoaded || NULL == m_hN4010ADll )
- {
- return false;
- }
- if( FreeLibrary( m_hN4010ADll ) == 0 )
- {
- PostMessage( hPostMsgDestHandle,
- WM_FREE_N4010A_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- m_bIsN4010ADllLoaded = false;
- m_hN4010ADll = NULL;
- return true;
- }
- //==============================================================================
- bool CDllMan::LoadControlsDllFunctions(HANDLE hPostMsgDestHandle)
- {
- if (m_bIsControlsDllLoaded) // loaded
- {
- return true;
- }
- m_hControlsDll = LoadLibrary("Controls.dll");
- if (NULL == m_hControlsDll)
- {
- PostMessage(hPostMsgDestHandle,
- WM_LOAD_CONTROLS_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (!load_Controls_Dll_functions(m_hControlsDll))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_CONTROLS_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- m_bIsControlsDllLoaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeControlsDll(HANDLE hPostMsgDestHandle)
- {
- if (!m_bIsControlsDllLoaded || NULL == m_hControlsDll)
- {
- return false;
- }
- //(FARPROC&)lpDllEntryPoint = GetProcAddress(hControls, _T("DllUnregisterServer"));
- //if (NULL == lpDllEntryPoint)
- // {
- // return false;
- // }
- // (*lpDllEntryPoint)();
- if (FreeLibrary(m_hControlsDll) == 0)
- {
- PostMessage(hPostMsgDestHandle,
- WM_FREE_CONTROLS_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- m_bIsControlsDllLoaded = false;
- m_hControlsDll = NULL;
- return true;
- }
- #if 0
- //==============================================================================
- bool CDllMan::LoadMfilesDllFunctions( HANDLE hPostMsgDestHandle )
- {
- if( isMfilesLoaded ) // loaded
- {
- return true;
- }
- hMfiles = LoadLibrary("Mfiles.dll");
- if ( hMfiles == NULL )
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_MFILES_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- else
- {
- if (! load_Mfiles_Dll_functions( hMfiles ))
- {
- PostMessage( hPostMsgDestHandle,
- WM_LOAD_MFILES_DLL_FUNCTION_FAILED,
- 0,
- 0
- );
- return false;
- }
- }
- isMfilesLoaded = true;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CDllMan::FreeMfilesDll( HANDLE hPostMsgDestHandle )
- {
- if( isMfilesLoaded == false || hMfiles == NULL )
- {
- return false;
- }
- if( FreeLibrary( hMfiles ) == 0 )
- {
- PostMessage( hPostMsgDestHandle,
- WM_FREE_MFILES_DLL_FAILED,
- 0,
- 0
- );
- return false;
- }
- isMfilesLoaded = false;
- hMfiles = NULL;
- return true;
- }
- #endif