Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi
Can any one plz help me out i'm getting any exception while using STRTOWSTR()
Plz review the code and tell me the problem

JulianType *pDate = NULL;
char *pTempStore = NULL;
AECHAR *pTextToDraw = NULL;

pDate = (JulianType*)MALLOC(sizeof(JulianType));

GETJULIANDATE(0, pDate);
char * pTime = (char*)MALLOC(sizeof(char));
if(pTime)
{
itoa(pDate->wYear, pTime, 10);
pTempStore = (char*)MALLOC(sizeof(char));

if(pTempStore)
{
STRCPY(pTempStore, pTime);
STRCAT(pTempStore, "/t");

itoa(pDate->wMonth, pTime, 10);
STRCAT(pTempStore, pTime);
STRCAT(pTempStore, "/t");

itoa(pDate->wDay, pTime, 10);
STRCAT(pTempStore, pTime);
STRCAT(pTempStore, "/t");

itoa(pDate->wHour, pTime, 10);
STRCAT(pTempStore, pTime);
STRCAT(pTempStore, "/t");

itoa(pDate->wMinute, pTime, 10);
STRCAT(pTempStore, pTime);
STRCAT(pTempStore, "/t");

itoa(pDate->wSecond, pTime, 10);
STRCAT(pTempStore, pTime);
STRCAT(pTempStore, "/t");

FREEIF(pTime);
pTime = NULL;
}

pTextToDraw = (AECHAR*)MALLOC(sizeof(AECHAR));
if(pTextToDraw)
{
STRTOWSTR(pTempStore, pTextToDraw, 20*sizeof(AECHAR)* STRLEN(pTempStore));
IDISPLAY_DrawText(pMMD->a.m_pIDisplay, (AEEFont)IDI_FONT, pTextToDraw,
-1, 0, 50, NULL, IDF_TEXT_TRANSPARENT|IDF_RECT_FRAME );
IDISPLAY_Update(pMMD->a.m_pIDisplay);
}

The error is:- Unhandled exception in BREW emulator.exe: Access violation

u have not allocated sufficient memory to the buffer.
do some thing like this before storing value to it
char* buffer = NULL
//if u want to store "test" in ur buffer
buffer = (char*) MALLOC (STRLEN("test")+1);
STRCPY(buffer,"test");

u have not allocated sufficient memory to the buffer.
do some thing like this before storing value to it
char* buffer = NULL
//if u want to store "test" in ur buffer
buffer = (char*) MALLOC (STRLEN("test")+1);
STRCPY(buffer,"test");

Thanks a lot mk.manju :)
Can u plz help me in customizing the menu control i'd tried following code but i'm not able to change color of menu title and its background color
IMENUCTL_SetRect(g_pAPP->m_pMenu, &rect);
mc.wMask = MC_TITLE | MC_TITLE_TEXT;
mc.cTitle = MAKE_RGB(0, 60, 115);
mc.cTitleText = MAKE_RGB(255, 255, 255);
IMENUCTL_SetColors(g_pAPP->m_pMenu, &mc);
IMENUCTL_SetTitle(g_pAPP->m_pMenu, NULL, NULL, L"Folder Menu");
Though with this code i'm able to change selected text color, background color of menu etc.

Thanks a lot mk.manju :)
Can u plz help me in customizing the menu control i'd tried following code but i'm not able to change color of menu title and its background color
IMENUCTL_SetRect(g_pAPP->m_pMenu, &rect);
mc.wMask = MC_TITLE | MC_TITLE_TEXT;
mc.cTitle = MAKE_RGB(0, 60, 115);
mc.cTitleText = MAKE_RGB(255, 255, 255);
IMENUCTL_SetColors(g_pAPP->m_pMenu, &mc);
IMENUCTL_SetTitle(g_pAPP->m_pMenu, NULL, NULL, L"Folder Menu");
Though with this code i'm able to change selected text color, background color of menu etc.

i think u can set the title color but u cant change it.
since u don't get focus on it..

i think u can set the title color but u cant change it.
since u don't get focus on it..

I'd set color for menu control bakground the same color is set for Tiltle, & the color i'd set for unselected text in Menu control automatically set for title text also now i'm not able to change them. Is there any way to alter the color, plz let me know. :confused:

I'd set color for menu control bakground the same color is set for Tiltle, & the color i'd set for unselected text in Menu control automatically set for title text also now i'm not able to change them. Is there any way to alter the color, plz let me know. :confused: