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

Developer

Forums

Forums:

Hi
Please help me.
I want to get the application name in my applet.
this problem seems too simple,but I don't known how to do.

How to get application name in applet? How to get application name in applet? :mad:

How to get application name in applet? How to get application name in applet? :mad:

Hi
Please help me.
I want to get the application name in my applet.
this problem seems too simple,but I don't known how to do.

Hi
Please help me.
I want to get the application name in my applet.
this problem seems too simple,but I don't known how to do.

Could you possibly be a bit more specific?
Have you looked at the API documentation?
It would be very helpful to know what you are trying to do, how you've tried to do it, and what problems you've run into.

Could you possibly be a bit more specific?
Have you looked at the API documentation?
It would be very helpful to know what you are trying to do, how you've tried to do it, and what problems you've run into.

Hi:
I want to get the appplet's name in the mif file by BREW API,I can NOT found it ,But I found a ISHELL_GetAppVersion to get version setted in mif.

Hi:
I want to get the appplet's name in the mif file by BREW API,I can NOT found it ,But I found a ISHELL_GetAppVersion to get version setted in mif.

Hi:
I want to get the appplet's name in the mif file by BREW API,I can NOT found it ,But I found a ISHELL_GetAppVersion to get version setted in mif.

Hi:
I want to get the appplet's name in the mif file by BREW API,I can NOT found it ,But I found a ISHELL_GetAppVersion to get version setted in mif.

You're better off storing the app name in a resource file (.bar). You can then get the string using ISHELL_LoadResString().

You're better off storing the app name in a resource file (.bar). You can then get the string using ISHELL_LoadResString().

First of all, the best solution would be to simply store the application name in the string. However, you may access the information from the applet's MIF file. To do so, you would need to do the following:
1. Call ISHELL_EnumAppletInit()
2. Enumerate through the applets on the device with ISHELL_EnumNextApplet() until your class ID is found
3. Call ISHELL_LoadResString() to get the applet name string from the MIF using the information from the AEEAppInfo structure
4. The information from the MIF is fetched with resource id = wIDBase + offset, using the offsets defined in AEEShell.h:
#define IDR_NAME_OFFSET 0
#define IDR_ICON_OFFSET 1
#define IDR_IMAGE_OFFSET 2
#define IDR_THUMB_OFFSET 3
#define IDR_SETTINGS_OFFSET 4
#define IDR_VERSION_OFFSET 5
#define IDR_OFFSET_STEP 20
#define IDS_MIF_COMPANY (6) // Company Name
#define IDS_MIF_COPYRIGHT (7) // Copyright Date
#define IDS_MIF_VERSION (8) // Module version
You may also use the provided macros to simplify matters:
#define APPR_NAME(ai) (uint16)(((ai).wIDBase + IDR_NAME_OFFSET))
#define APPR_ICON(ai) (uint16)(((ai).wIDBase + IDR_ICON_OFFSET))
#define APPR_IMAGE(ai) (uint16)(((ai).wIDBase + IDR_IMAGE_OFFSET))
#define APPR_THUMB(ai) (uint16)(((ai).wIDBase + IDR_THUMB_OFFSET))
#define APPR_SETTINGS(ai) (uint16)(((ai).wIDBase + IDR_SETTINGS_OFFSET))
#define APPR_VERSION(ai) (uint16)(((ai).wIDBase + IDR_VERSION_OFFSET))
The following code is an example of how to fetch the title from the MIF of a Helloworld application:
AEEAppInfo ai;
AEECLSID ci;
ISHELL_EnumAppletInit(pMe->a.m_pIShell);
do
{
ci = ISHELL_EnumNextApplet(pMe->a.m_pIShell, &ai);
if(ci == AEECLSID_HELLOWORLD)
{
AECHAR szBuff [50];
if(0 != ISHELL_LoadResString(pMe->a.m_pIShell, ai.pszMIF, (int16)(ai.wIDBase + IDR_NAME_OFFSET), szBuff, sizeof(szBuff)))
{
DBGPRINTF("app title = %S", szBuff);
}
else
DBGPRINTF("could not fetch app title");
}
} while(0 != ci && AEECLSID_HELLOWORLD != ci);

First of all, the best solution would be to simply store the application name in the string. However, you may access the information from the applet's MIF file. To do so, you would need to do the following:
1. Call ISHELL_EnumAppletInit()
2. Enumerate through the applets on the device with ISHELL_EnumNextApplet() until your class ID is found
3. Call ISHELL_LoadResString() to get the applet name string from the MIF using the information from the AEEAppInfo structure
4. The information from the MIF is fetched with resource id = wIDBase + offset, using the offsets defined in AEEShell.h:
#define IDR_NAME_OFFSET 0
#define IDR_ICON_OFFSET 1
#define IDR_IMAGE_OFFSET 2
#define IDR_THUMB_OFFSET 3
#define IDR_SETTINGS_OFFSET 4
#define IDR_VERSION_OFFSET 5
#define IDR_OFFSET_STEP 20
#define IDS_MIF_COMPANY (6) // Company Name
#define IDS_MIF_COPYRIGHT (7) // Copyright Date
#define IDS_MIF_VERSION (8) // Module version
You may also use the provided macros to simplify matters:
#define APPR_NAME(ai) (uint16)(((ai).wIDBase + IDR_NAME_OFFSET))
#define APPR_ICON(ai) (uint16)(((ai).wIDBase + IDR_ICON_OFFSET))
#define APPR_IMAGE(ai) (uint16)(((ai).wIDBase + IDR_IMAGE_OFFSET))
#define APPR_THUMB(ai) (uint16)(((ai).wIDBase + IDR_THUMB_OFFSET))
#define APPR_SETTINGS(ai) (uint16)(((ai).wIDBase + IDR_SETTINGS_OFFSET))
#define APPR_VERSION(ai) (uint16)(((ai).wIDBase + IDR_VERSION_OFFSET))
The following code is an example of how to fetch the title from the MIF of a Helloworld application:
AEEAppInfo ai;
AEECLSID ci;
ISHELL_EnumAppletInit(pMe->a.m_pIShell);
do
{
ci = ISHELL_EnumNextApplet(pMe->a.m_pIShell, &ai);
if(ci == AEECLSID_HELLOWORLD)
{
AECHAR szBuff [50];
if(0 != ISHELL_LoadResString(pMe->a.m_pIShell, ai.pszMIF, (int16)(ai.wIDBase + IDR_NAME_OFFSET), szBuff, sizeof(szBuff)))
{
DBGPRINTF("app title = %S", szBuff);
}
else
DBGPRINTF("could not fetch app title");
}
} while(0 != ci && AEECLSID_HELLOWORLD != ci);

Hi
Sorry,I test it on my BREW 2.0 zh SDK,it's return a empty string,Why it can NOT work??

Hi
Sorry,I test it on my BREW 2.0 zh SDK,it's return a empty string,Why it can NOT work??

It works just fine on my version of the 2.0 SDK. Are you sure you put a name in your MIF? Did you modify the class ID the method is looking for?

It works just fine on my version of the 2.0 SDK. Are you sure you put a name in your MIF? Did you modify the class ID the method is looking for?

I add the enum_init before the loop,it's OK!
Thanks.

I add the enum_init before the loop,it's OK!
Thanks.

Oops, I forgot to copy that part. :o
Fixed.

Oops, I forgot to copy that part. :o
Fixed.