📄 brewextension.c
字号:
/*===========================================================================
FILE: brewextension.c
===========================================================================*/
/*===============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================== */
#include "AEEShell.h" // Shell interface definitions
#include "AEEStdlib.h"
#include "brewextension.bid"
#include "brewextension.h"
/*-------------------------------------------------------------------
Applet structure. All variables in here are reference via "pMe->"
-------------------------------------------------------------------*/
// create an applet structure that's passed around. All variables in
// here will be able to be referenced as static.
typedef struct IBrewExtension
{
AEEVTBL(IBrewExtension) *pvt;
IShell *m_pIShell;
int m_nRefs;
} IBrewExtension;
int AEEClsCreateInstance(IShell *pIShell, AEECLSID cls, void **ppObj)
{
*ppObj = NULL;
if( cls == AEECLSID_BREWEXTENSION)
{
return IBrewExtension_New(pIShell, cls, (IBrewExtension**)ppObj);
}
return EFAILED;
}
int IBrewExtension_Release(IBrewExtension *pMe)
{
if( --pMe->m_nRefs != 0 )
{
return pMe->m_nRefs;
}
FREE_VTBL(pMe, IModule);
FREE( pMe );
return 0;
}
int IBrewExtension_AddRef(IBrewExtension *pMe)
{
return ++(pMe->m_nRefs);
}
int IBrewExtension_MaxInt(IBrewExtension *pMe, int iValue1, int iValue2)
{
return iValue1 > iValue2 ? iValue1:iValue2;
}
int IBrewExtension_New(IShell *pIShell, AEECLSID cls, void **ppObj)
{
int nSize;
IBrewExtension *pMe = NULL;
VTBL(IBrewExtension) *modFuncs;
nSize = sizeof(IBrewExtension);
if( (pMe = (IBrewExtension*)MALLOC(nSize +
sizeof(VTBL(IBrewExtension)))) == NULL )
return ENOMEMORY;
modFuncs = (VTBL(IBrewExtension)*)((byte *)pMe + nSize);
modFuncs->AddRef = IBrewExtension_AddRef;
modFuncs->Release = IBrewExtension_Release;
modFuncs->MaxInt = IBrewExtension_MaxInt;
INIT_VTBL(pMe, IBrewExtension, *modFuncs);
pMe->m_nRefs = 1;
pMe->m_pIShell = pIShell;
ISHELL_AddRef(pIShell);
*ppObj = (IModule*)pMe;
return AEE_SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -