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

Developer

Forums

Forums:

Hello,

I want to display the data in a tree structure in this function. But, the program was not responding. I converted the data encoding from UTF-8 to WSTR using UTF8_TO_WSTR(). What's wrong with it?

What kind of interfaces should I be using, IDisplay_DrawText()? Can it be data encoding, bec. input data is UTF-8, and BREW wants AECHAR?

Thank you.

Instead of UTF8_TO_WSTR use UTF8TOWSTR, because the first one is deprecated.
You need to allocated the buffer for psTextBuf. UTF8 can have 1 to 6 bytes per code point but for UTF16 it is 2 bytes per code point. So if you do
int wStrLen = sizeof(contentData) * sizeof(AECHAR);
psTextBuf = (AECHAR*)MALLOC( wStrLen + 1 * sizeof(AECHAR) );
1 * sizeof(AECHAR) for NULL termination.
Now when you call UTF8TOWSTR, your last parameter would be wStrLen, length in bytes.

Instead of UTF8_TO_WSTR use UTF8TOWSTR, because the first one is deprecated.
You need to allocated the buffer for psTextBuf. UTF8 can have 1 to 6 bytes per code point but for UTF16 it is 2 bytes per code point. So if you do
int wStrLen = sizeof(contentData) * sizeof(AECHAR);
psTextBuf = (AECHAR*)MALLOC( wStrLen + 1 * sizeof(AECHAR) );
1 * sizeof(AECHAR) for NULL termination.
Now when you call UTF8TOWSTR, your last parameter would be wStrLen, length in bytes.

Thank you, ruben. I followed your directions and modified it and the application still won't display. What's wrong?
I just want to use libxml2 to parse the XML into a data tree structure where I can walk the tree and display the results. I have included libxml2 in my project and it ran fine. But how can I be sure that the data is parsed and passed to BREW, since nothing is showing right now, I can't even start the applcation. It just says "this application is unloaded to save memory. Please download a new version".
I'm all out of idea. This Brew stuff is all new to me. Thank you very much.:D

Thank you, ruben. I followed your directions and modified it and the application still won't display. What's wrong?
I just want to use libxml2 to parse the XML into a data tree structure where I can walk the tree and display the results. I have included libxml2 in my project and it ran fine. But how can I be sure that the data is parsed and passed to BREW, since nothing is showing right now, I can't even start the applcation. It just says "this application is unloaded to save memory. Please download a new version".
I'm all out of idea. This Brew stuff is all new to me. Thank you very much.:D

yay, code barf!
I'm adding code formatting tags to this...in the future, you might want to use them yourself. Just bracket your code with [code] tags.

yay, code barf!
I'm adding code formatting tags to this...in the future, you might want to use them yourself. Just bracket your code with [code] tags.

Quote:Originally posted by mohlendo
yay, code barf!
I'm adding code formatting tags to this...in the future, you might want to use them yourself. Just bracket your code with [code] tags.
Thanks, but can you find any problem with my code? Is it because libxml2 is not imported right?
Thank you.

Quote:Originally posted by mohlendo
yay, code barf!
I'm adding code formatting tags to this...in the future, you might want to use them yourself. Just bracket your code with [code] tags.
Thanks, but can you find any problem with my code? Is it because libxml2 is not imported right?
Thank you.

Quote:Originally posted by mzichao
...I can't even start the applcation. It just says "this application is unloaded to save memory. Please download a new version".
This isn't a problem with your code. The emulator can't find your DLL. Check this thread for information on specifying directories in the Emulator.

Quote:Originally posted by mzichao
...I can't even start the applcation. It just says "this application is unloaded to save memory. Please download a new version".
This isn't a problem with your code. The emulator can't find your DLL. Check this thread for information on specifying directories in the Emulator.

I encountered the same problem before. I changed it from Debug/catalog.dll to catalog.dll. Then, no problem. But after I changed my codes these few days, it appears again.
My path is like this:
I'm in:
C:\program files\brew\examples\app_name.mif
C:\program files\brew\examples\app\app_name.dll
I need this:
applet: C:\program files\brew\examples\.. (set in emulator)
mif: C:\program files\brew\examples\..(set in emulator)
dll: C:\program files\brew\examples\app\..(set in link on VC++)
What indicates an applet? Any solutions?

I encountered the same problem before. I changed it from Debug/catalog.dll to catalog.dll. Then, no problem. But after I changed my codes these few days, it appears again.
My path is like this:
I'm in:
C:\program files\brew\examples\app_name.mif
C:\program files\brew\examples\app\app_name.dll
I need this:
applet: C:\program files\brew\examples\.. (set in emulator)
mif: C:\program files\brew\examples\..(set in emulator)
dll: C:\program files\brew\examples\app\..(set in link on VC++)
What indicates an applet? Any solutions?

Quote:Originally posted by mzichao
C:\program files\brew\examples\app\app_name.dll
Is this file path actually
C:\program files\brew\examples\app_name\app_name.dll?
If not, you should modify it.

Quote:Originally posted by mzichao
C:\program files\brew\examples\app\app_name.dll
Is this file path actually
C:\program files\brew\examples\app_name\app_name.dll?
If not, you should modify it.

Quote:Originally posted by mohlendo
Is this file path actually
C:\program files\brew\examples\app_name\app_name.dll?
If not, you should modify it.
Yes, dll is is in that directory. On Link option at Setting, I just put "app.dll". That's ok, right? Do I need to include C:\... stuff?

Quote:Originally posted by mohlendo
Is this file path actually
C:\program files\brew\examples\app_name\app_name.dll?
If not, you should modify it.
Yes, dll is is in that directory. On Link option at Setting, I just put "app.dll". That's ok, right? Do I need to include C:\... stuff?

No, all you need is app_name.dll

No, all you need is app_name.dll

Well, I did that and still the same thing.......what else could be the problem?

Well, I did that and still the same thing.......what else could be the problem?

1. Does your MIF have the same name as your application directory? No - rename them.
2. Is there a dll in your application directory? No - build the DLL.
3. You said your fil structure was like this:
\myapp.mif
\myapp\myapp.dll
Did you specify as the applet and mif directory within the Emulator? No - do it.

1. Does your MIF have the same name as your application directory? No - rename them.
2. Is there a dll in your application directory? No - build the DLL.
3. You said your fil structure was like this:
\myapp.mif
\myapp\myapp.dll
Did you specify as the applet and mif directory within the Emulator? No - do it.

Quote:Originally posted by mohlendo
1. Does your MIF have the same name as your application directory? No - rename them.
2. Is there a dll in your application directory? No - build the DLL.
3. You said your fil structure was like this:
\myapp.mif
\myapp\myapp.dll
Did you specify as the applet and mif directory within the Emulator? No - do it.
Yep. I triple checked. This is so wield.......Any other idea? I tried reinstall the SDK, got another MIF, tried open a new project...

Quote:Originally posted by mohlendo
1. Does your MIF have the same name as your application directory? No - rename them.
2. Is there a dll in your application directory? No - build the DLL.
3. You said your fil structure was like this:
\myapp.mif
\myapp\myapp.dll
Did you specify as the applet and mif directory within the Emulator? No - do it.
Yep. I triple checked. This is so wield.......Any other idea? I tried reinstall the SDK, got another MIF, tried open a new project...

Quote:Originally posted by mzichao
I'm in:
C:\program files\brew\examples\app_name.mif
C:\program files\brew\examples\app\app_name.dll
I need this:
applet: C:\program files\brew\examples\.. (set in emulator)
mif: C:\program files\brew\examples\..(set in emulator)
dll: C:\program files\brew\examples\app\..(set in link on VC++)
does the space in "C:\program files\brew\examples\" matters? i always install the BREW SDK in a directory without spaces, such as ""D:\BREWSDK\BREW201\..."". it works fine if i follow this rules. :)
-michael"

Quote:Originally posted by mzichao
I'm in:
C:\program files\brew\examples\app_name.mif
C:\program files\brew\examples\app\app_name.dll
I need this:
applet: C:\program files\brew\examples\.. (set in emulator)
mif: C:\program files\brew\examples\..(set in emulator)
dll: C:\program files\brew\examples\app\..(set in link on VC++)
does the space in "C:\program files\brew\examples\" matters? i always install the BREW SDK in a directory without spaces, such as ""D:\BREWSDK\BREW201\..."". it works fine if i follow this rules. :)
-michael"

It shouldn't...the only weird problem with naming I've noticed in the BREW SDKs is that 1.1 had problems with SDK directory names that contained periods. Spaces shouldn't cause any trouble.

It shouldn't...the only weird problem with naming I've noticed in the BREW SDKs is that 1.1 had problems with SDK directory names that contained periods. Spaces shouldn't cause any trouble.