/*===================================================
FILE: event1.c
====================================================*/
#define _EVENT1_C
/*===================================================
INCLUDES AND VARIABLE DEFINITIONS
================================================== */
#include "event1.h"
#include "event1Ctl.h" // 追加:イベント処理
/*===============================================
FUNCTION DEFINITIONS
================================================== */
/*=================================================
FUNCTION: AEEClsCreateInstance
====================================================*/
int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell,
IModule *po, void **ppObj)
{
*ppObj = NULL;
if( ClsId == AEECLSID_EVENT1 )
{
// Create the applet and make room for the applet structure
if( AEEApplet_New(sizeof(event1),
ClsId,
pIShell,
po,
(IApplet**)ppObj,
(AEEHANDLER)event1_HandleEvent,
(PFNFREEAPPDATA)event1_FreeAppData) )
{
// to the HandleEvent function
if(event1_InitAppData((event1*)*ppObj))
{
//Data initialized successfully
return(AEE_SUCCESS);
}
else
{
// AEEApplet_New was called.
IAPPLET_Release((IApplet*)*ppObj);
return EFAILED;
}
} // end AEEApplet_New
}
return(EFAILED);
}
/*===========================================
FUNCTION SampleAppWizard_HandleEvent
=================================================*/
static boolean event1_HandleEvent(event1* pMe, AEEEvent eCode,
uint16 wParam, uint32 dwParam)
{
if ( pMe == NULL )
return FALSE;
if ( pMe->pElist == NULL )
return FALSE;
return IEVENTLIST_HandleEvent(pMe->pElist,eCode,wParam,dwParam);
}
// this function is called when your application is starting up
boolean event1_InitAppData(event1* pMe)
{
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);
pMe->pIDisplay = pMe->a.m_pIDisplay;
pMe->pIShell = pMe->a.m_pIShell;
// Insert your code here for initializing or allocating resources...
// イベント領域確保
if ( (pMe->pElist = IEVENTLIST_Create() ) == NULL )
{
return FALSE;
}
// イベント設定
IEVENTLIST_Add(pMe->pElist,pMe,IEVENTLIST_KIND_ECODE,EVT_APP_START,
0,0,event1_STARTEvent);
IEVENTLIST_Add(pMe->pElist,pMe,IEVENTLIST_KIND_WPARAM,EVT_KEY,AVK_CLR,
0,event1_CLREvent);
return TRUE;
}
// this function is called when your application is exiting
void event1_FreeAppData(event1* pMe)
{
IEVENTLIST_Release(pMe->pElist);
}
|