请教:调用ITEXTCTL_SetRect()函数后程序异常
大家好,我在调用ITEXTCTL_SetRect()函数的时候,程序崩溃,说是非法访问内存,是为什么呢?
[最优解释]
参数不正确吧
[其他解释]
我把代码贴出来吧:
boolean text_InitControl(CText *pMe)
{
ITextCtl *pITextCtl = NULL; // TEXT CONTROL
AEERect nTextRect;
AECHAR szTitle[] = {'I', 'n', 'p', 'u', 't', 0};
// 创建控件对象
int ret = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_CTEXT, (void**)(&pMe->m_pObj));
if (ret != SUCCESS)
{
return FALSE;
}
pITextCtl = (ITextCtl*)pMe->m_pObj;
// 设置需要的属性
SETAEERECT(&nTextRect,
pMe->m_nClntAreaRect.x,
(pMe->m_nClntAreaRect.dy - pMe->m_nLargeLineHeight * 3) / 2,
pMe->m_nClntAreaRect.dx,
pMe->m_nLargeLineHeight * 3);
ITEXTCTL_SetRect(pITextCtl, &nTextRect);
ITEXTCTL_SetProperties(pITextCtl, TP_FRAME);
ITEXTCTL_SetMaxSize(pITextCtl, 2);
ITEXTCTL_SetTitle(pITextCtl, NULL, 0, szTitle);
// 设置为数字模式
ITEXTCTL_SetInputMode(pITextCtl, AEE_TM_NUMBERS);
// 激活
ITEXTCTL_SetActive(pITextCtl, TRUE);
pMe->m_nState = STATE_SELSTAGE;
return TRUE;
}