请问这个菜单加载的程序哪里出了错?
我在这里将数据定义,初始化函数,和菜单加载函数那出来,请大家帮忙分析,我是在_HandleEvent()里调用menu_Start()
字符窜资源与位图资源在资源编辑器中已经编译了。
运行结果:该程序运行后显示的是一片空白。
typedef struct _CMenu
{
AEEApplet a;
AEEDeviceInfo DeviceInfo; // always have access to the hardware device information
IDisplay *pIDisplay; // give a standar way to access the display interface
IShell *pIShell; // give a standar way to access the shell interface
int m_nScrWidth;
int m_nScrHeight;
int m_nLineHeight;
int m_nLargeLineHeight;
AEERect m_nCIntAreaRect;
uint8 m_nState;
void* m_pObj;
}CMenu;
static boolean menu_Start(CMenu* pApp)
{
IMenuCtl* pMenuCtl=NULL;
CtlAddItem rMenuItem;
AEERect nRect;
AEEItemStyle nNormal;
AEEItemStyle nSel;
if(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_MENUCTL,
(void**)(&pApp->m_pObj))!=SUCCESS)
return FALSE;
// Fill in the CtlAddItem structure values
pMenuCtl=(IMenuCtl*)pApp->m_pObj;
IMENUCTL_Reset(pMenuCtl);
IMENUCTL_SetActive(pMenuCtl,FALSE);
rMenuItem.pText=NULL;
rMenuItem.pImage=NULL;
rMenuItem.pszResImage=rMenuItem.pszResText=CMENU_RES_FILE;//resourc file name
rMenuItem.wFont=AEE_FONT_NORMAL;
rMenuItem.wText=IDS_STRING_START;
rMenuItem.wImage=IDI_IMAGE_STA;
rMenuItem.wItemID=IDS_STRING_START;
IMENUCTL_AddItemEx(pMenuCtl,&rMenuItem);
rMenuItem.wText=IDS_STRING_SEL;
rMenuItem.wImage=IDI_IMAGE_SEL;
rMenuItem.wItemID=IDS_STRING_SEL;
IMENUCTL_AddItemEx(pMenuCtl, &rMenuItem);
nNormal.ft=AEE_FT_NONE;
nNormal.xOffset=nNormal.yOffset=0;
nNormal.roImage=AEE_RO_COPY;
nSel.ft=AEE_FT_BOX;
nSel.xOffset=nSel.yOffset=0;
nSel.roImage=AEE_RO_NOT;
IMENUCTL_SetStyle(pMenuCtl, &nNormal, &nSel);
IMENUCTL_SetProperties(pMenuCtl, IMENUCTL_GetProperties(pMenuCtl) &
~(MP_ICON_TEXT_TOP));
SETAEERECT(&nRect, 0, 0, pApp->m_nScrWidth, pApp->m_nScrHeight);
IMENUCTL_SetRect(pMenuCtl, &nRect);
IMENUCTL_SetActive(pMenuCtl, TRUE);
IDISPLAY_Update(pApp->pIDisplay);
return TRUE;
}
boolean CMenu_InitAppData(CMenu* pMe)
{
// Get the device information for this handset.
// Reference all the data by looking at the pMe->DeviceInfo structure
// Check the API reference guide for all the handy device info you can get
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);
// Insert your code here for initializing or allocating resources...
pMe->pIShell=pMe->a.m_pIShell;
pMe->pIDisplay=pMe->a.m_pIDisplay;
// Insert your code here for initializing or allocating resources...
pMe->m_nLineHeight=IDISPLAY_GetFontMetrics(pMe->a.m_pIDisplay,
AEE_FONT_NORMAL,
NULL,
NULL);
pMe->m_nLargeLineHeight=IDISPLAY_GetFontMetrics(pMe->a.m_pIDisplay,
AEE_FONT_LARGE,
NULL,
NULL);
pMe->m_nScrHeight=pMe->DeviceInfo.cyScreen;
pMe->m_nScrWidth=pMe->DeviceInfo.cxScreen;
SETAEERECT(&pMe->m_nCIntAreaRect,
0,
0,
pMe->DeviceInfo.cxScreen,
pMe->DeviceInfo.cyScreen-pMe->m_nLargeLineHeight);
pMe->m_pObj=NULL;
// if there have been no failures up to this point then return success
return TRUE;
}