📄 vmextdllmanager.h
字号:
#ifndef VM_DLL_EXT_MANAGER_H_INCLUDED
#define VM_DLL_EXT_MANAGER_H_INCLUDED
/*****************************************************************************/
/* HEADER FILE */
/*****************************************************************************/
/*
$Archive: $
$Revision: $
$Date: $
$Author: $
Description: Declaration of the class that provides an object wrapper
over a dll that complies with a specific interface
This class acts as an interface to the various DLLs that
are dynamically linked into the process. It gets the
addresses of certain functions exported from the dll and
allows the user to call them through a C++ interface.
TOOL And XML FORMS License
==========================
Except where otherwise noted, all of the documentation
and software included in the TOOL package is
copyrighted by Michael Swartzendruber.
Copyright (C) 2005 Michael John Swartzendruber.
All rights reserved.
Access to this code, whether intentional or accidental,
does NOT IMPLY any transfer of rights.
This software is provided "as-is," without any express
or implied warranty. In no event shall the author be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for
any purpose, including commercial applications, and to
alter and redistribute it, provided that the following
conditions are met:
1. All redistributions of source code files must retain
all copyright notices that are currently in place,
and this list of conditions without modification.
2. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
3. If you use this software in another product, an acknowledgment
in the product documentation would be appreciated but is
not required.
4. Modified versions in source or binary form must be plainly
marked as such, and must not be misrepresented as being
the original software.
*/
/*****************************************************************************/
#include "../VMCoreGlobal.h"
// dll runtime method
//
static const char InitProcName[] = "Init";
static const char RunProcName[] = "RunCmd";
static const char CleanupProcName[] = "Cleanup";
class VMExtDllManager
{
public:
VMExtDllManager( const char* pchDllName );
~VMExtDllManager( void );
HRESULT Init( void ) const;
HRESULT RunCmd( int iMsg, int iCmd, int iParam, VMVariant* pvData ) const;
HRESULT Cleanup( void ) const;
bool IsGood( void ) const { return m_bIsGood; }
protected:
HMODULE LoadDLL( const char* pchDllName );
bool MapDllProcPtrs( void );
private:
// the types of functions exported from the DLLs managed by this
// object
//
typedef long (*HR_v_Proc) ( void );
typedef long (*HR_Job_Proc) ( int, int, int, VMVariant* );
bool m_bIsGood;
HMODULE m_hDLLHandle;
HR_v_Proc m_pInit; //STDAPI InitForRun( void );
HR_Job_Proc m_pRunProcAddr; //STDAPI Run( VMVariant* poJob );
HR_v_Proc m_pCleanup; //STDAPI Cleanup( void );
};
#endif
/*****************************************************************************/
/* Check-in history */
/*
*$Log: $
*/
/*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -