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

Developer

Forums

Forums:

I create a dialog resource .
The error happened when i calling ISHELL_CreateDialog().
datail as followed.

resource name: "test.bar"
resource ID : 6001

#define APP_RES_FILE "test.bar"
#define IDD_DIALOG 6001

if ( ISHELL_CreateDialog (pApp->a.m_pIShell,
APP_RES_FILE,
IDD_DIALOG,
NULL) != AEE_SUCCESS)
return FALSE;

the error message is "*** Error - Duplicate Free 011B16B0 ***"

I do not know where is the error happened.
Tell me please.

what should be paying attention when i create a dialog resource.
what should be prepared before calling ISHELL_CreateDialog().

thanks very much!

Could you check the actual return value of ISHELL_CreateDialog()?
Does this error halt execution within the call to ISHELL_CreateDialog(), or does it appear sometime later?

Could you check the actual return value of ISHELL_CreateDialog()?
Does this error halt execution within the call to ISHELL_CreateDialog(), or does it appear sometime later?

Are you using the resource editor and source files from the same version of the SDK?
What version is the SDK?
Are you able to read a simpler resource, such as a string, from the resfile?
One suggestion is to create a very simple dialog, with a menu, and a menu title, and see whether or not you can load this.

Are you using the resource editor and source files from the same version of the SDK?
What version is the SDK?
Are you able to read a simpler resource, such as a string, from the resfile?
One suggestion is to create a very simple dialog, with a menu, and a menu title, and see whether or not you can load this.

thanks for the repliers
the error happen within calling ISHELL_CreateDialog(),and the program did not
go to the returned value.
the brew version i used is 2.10.
I can read a string resource from the same resource file by the same way.
but the dialog cannot loaded.

thanks for the repliers
the error happen within calling ISHELL_CreateDialog(),and the program did not
go to the returned value.
the brew version i used is 2.10.
I can read a string resource from the same resource file by the same way.
but the dialog cannot loaded.

Post the BRI file if you are allowed to do that.
Also, does the simple dialog load?

Post the BRI file if you are allowed to do that.
Also, does the simple dialog load?

1. I create a string resource (id=1)
2. I create a dialog resource (id=6001)
3. I create a dialog control (text)(id=7001)
then i save and compile it.
the name is test.bri, test.bar ,test_res.h
include "test_res.h"
static boolean test_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEApplet *pApp = (AEEApplet*)pi ;
int i;
switch (eCode)
{
case EVT_APP_START:
i = ISHELL_CreateDialog(pApp->m_pIShell ,RES_FILE ,RES_ID ,NULL);
return(TRUE);
so the error happened ,
where is the error?

1. I create a string resource (id=1)
2. I create a dialog resource (id=6001)
3. I create a dialog control (text)(id=7001)
then i save and compile it.
the name is test.bri, test.bar ,test_res.h
include "test_res.h"
static boolean test_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEApplet *pApp = (AEEApplet*)pi ;
int i;
switch (eCode)
{
case EVT_APP_START:
i = ISHELL_CreateDialog(pApp->m_pIShell ,RES_FILE ,RES_ID ,NULL);
return(TRUE);
so the error happened ,
where is the error?

The first line of the handler function is your problem
AEEApplet *pApp = (AEEApplet*)pi ;
You should be casting to your app structure, as in
MyApp *pApp = (MyApp*)pi;
Try that and see what happens.

The first line of the handler function is your problem
AEEApplet *pApp = (AEEApplet*)pi ;
You should be casting to your app structure, as in
MyApp *pApp = (MyApp*)pi;
Try that and see what happens.

... nope, that's not your problem; I misread AEEApplet as IApplet.
A test of your code works fine for me, even when the resource file is missing from the runtime directory.
Using the incorrect resource ID also triggers a meaningful error message.
Are you sure you are using the 2.1 resource editor?
What OS are you running this on, what is the LOCALE?

... nope, that's not your problem; I misread AEEApplet as IApplet.
A test of your code works fine for me, even when the resource file is missing from the runtime directory.
Using the incorrect resource ID also triggers a meaningful error message.
Are you sure you are using the 2.1 resource editor?
What OS are you running this on, what is the LOCALE?

the whole procedure:
the string resource:
ID = 1
NAME = TEST_STRING
FORMAT = ISOLATIN1
VALUE = liuliuliu
the dialog resource:
ID = 6001
NAME = TEST_DIALOG
POSITION = (-1, -1)
SIZE = (-1, -1)
DIALOG FLAGS = 0x 0
INITIAL FOCUS ID = 7001
AND NO TITLE
DIALOG CONTROLS:
ID = 7001
TYPE = Static
NAME = TEST_STATIC
CONTROL TITLE = liuliuliu
POSITION = (-1, -1)
SIZE = (-1, -1)
FLAGS = 0x 0
the programe
#include "test.bid"
#include "test_res.h"
#define SRC_FILE "test.bar"
#define SRC_ID 6001
static boolean test_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEApplet* pApp = (AEEApplet*)pi;
switch (eCode)
{
case EVT_APP_START:
if( ISHELL_CreateDialog(pApp->m_pIShell ,
SRC_FILE ,
SRC_ID ,NULL) != SUCCESS )
return FALSE;
the error is :user breakerpoint called from code at 0x418bea
the OS i used is window2000 english version
the resource editor is 2.1.0
i only installed the brew2.1.0
maybe i made some mistake when i creating the resource file.
maybe something be missed by me.
but i do not know what is it.
thank you for your suggestion.

the whole procedure:
the string resource:
ID = 1
NAME = TEST_STRING
FORMAT = ISOLATIN1
VALUE = liuliuliu
the dialog resource:
ID = 6001
NAME = TEST_DIALOG
POSITION = (-1, -1)
SIZE = (-1, -1)
DIALOG FLAGS = 0x 0
INITIAL FOCUS ID = 7001
AND NO TITLE
DIALOG CONTROLS:
ID = 7001
TYPE = Static
NAME = TEST_STATIC
CONTROL TITLE = liuliuliu
POSITION = (-1, -1)
SIZE = (-1, -1)
FLAGS = 0x 0
the programe
#include "test.bid"
#include "test_res.h"
#define SRC_FILE "test.bar"
#define SRC_ID 6001
static boolean test_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEEApplet* pApp = (AEEApplet*)pi;
switch (eCode)
{
case EVT_APP_START:
if( ISHELL_CreateDialog(pApp->m_pIShell ,
SRC_FILE ,
SRC_ID ,NULL) != SUCCESS )
return FALSE;
the error is :user breakerpoint called from code at 0x418bea
the OS i used is window2000 english version
the resource editor is 2.1.0
i only installed the brew2.1.0
maybe i made some mistake when i creating the resource file.
maybe something be missed by me.
but i do not know what is it.
thank you for your suggestion.

could you tell me the way
thank you

could you tell me the way
thank you

Here is what I have found out, but the answer isn't complete:
1. In a minimal "Helloworld" style app, the error that you report occurs.
2. In a larger app, that has a custom data structure, the error does not occur.
One of the earliest versions of BREW had more sample apps, and I am attaching a variation of the one for testing dialogs.
I added your code to this app, and the _CreateDialog() works fine.
Go to line 858 of idialogusage.c to see where the call is made. The code after that point clashes with the original example code, so you will need to clean it up a bit to see your dialog.
I have included the test.bri, test.bar files with the dialog code, so it's up to you to get from where this app works to where you want your app to be.
*****
Dialog titles, if I remember correctly, cannot be set in the resource editor. The standard workaround is that one usually sets the title of one of the child dialog controls, such as a menu title, or a text control title.
For more ideas, seach the forum on "dialog" or "dialog title"

Here is what I have found out, but the answer isn't complete:
1. In a minimal "Helloworld" style app, the error that you report occurs.
2. In a larger app, that has a custom data structure, the error does not occur.
One of the earliest versions of BREW had more sample apps, and I am attaching a variation of the one for testing dialogs.
I added your code to this app, and the _CreateDialog() works fine.
Go to line 858 of idialogusage.c to see where the call is made. The code after that point clashes with the original example code, so you will need to clean it up a bit to see your dialog.
I have included the test.bri, test.bar files with the dialog code, so it's up to you to get from where this app works to where you want your app to be.
*****
Dialog titles, if I remember correctly, cannot be set in the resource editor. The standard workaround is that one usually sets the title of one of the child dialog controls, such as a menu title, or a text control title.
For more ideas, seach the forum on "dialog" or "dialog title"

Sorry for this Diversion
But have u handled
EVT_DIALOG_INIT
EVT_DIALOG_START
EVT_DIALOG_END
These Events.
U should return true on these events. Their handling is mandatory and not handling them may be one of the reasons of CreateDialog Failure
Regards

Sorry for this Diversion
But have u handled
EVT_DIALOG_INIT
EVT_DIALOG_START
EVT_DIALOG_END
These Events.
U should return true on these events. Their handling is mandatory and not handling them may be one of the reasons of CreateDialog Failure
Regards

Right you are Shantanu.
Once EVT_DLG_START and EVT_DLG_INIT are used, the call to ISHELL_CreateDialog() succeeds; perhaps EVT_DLG_END is needed later, but it works without it.
The docs don't emphasize the requirements for these, but they're necessary.
Thanks for the info.

Right you are Shantanu.
Once EVT_DLG_START and EVT_DLG_INIT are used, the call to ISHELL_CreateDialog() succeeds; perhaps EVT_DLG_END is needed later, but it works without it.
The docs don't emphasize the requirements for these, but they're necessary.
Thanks for the info.

Now I see.
thanks very much.
best regards.

Now I see.
thanks very much.
best regards.

Huh, encountered the same problem. Forgot to handle those events.

Huh, encountered the same problem. Forgot to handle those events.

Just wanted to say thank-you for this forum entry. Fixed my problem also. :) The SDK manual uses words like "can" and "not required" with respect to the handling of these events. It really needs to explicitely say "you must ...".

Just wanted to say thank-you for this forum entry. Fixed my problem also. :) The SDK manual uses words like "can" and "not required" with respect to the handling of these events. It really needs to explicitely say "you must ...".