Let me clarify my question. As the parameter list of MenuCmdBarAddButton only has the resource ID for the bitmap of the button, but no the DmOpenRef, so in order to make sure the bitmap res ID is referring my bitmap, DmOpenDatabaseByTypeCreator MUST be called just before MenuCmdBarAddButton so that the db containing the bitmap is at the topmost of the opened database list.
Up to now, it is what I believe. Please advise me if there is any alternative or any misunderstanding. The problem is that the notification system only provides sysNotifyMenuCmdBarOpenEvent, but does not provide any notification event for the closing of the menu command bar. Thus, I don't know when I should close my database with the bitmap. Is there any one successfully add a button on command bar for ANY running application?? Please help me and any idea is welcome! Thanks!!! Regards, Edmund "Edmund" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I'm writing an app to add an extra button on the command shortcut bar when > ALL other applications running. I register my codes to respond > sysNotifyMenuCmdBarOpenEvent, and when responding this notification event, > MenuCmdBarAddButton is run as below. > > if (((SysNotifyParamType*)cmdPBP)->notifyType == > sysNotifyMenuCmdBarOpenEvent){ > dbP = DmOpenDatabaseByTypeCreator(myAppFileType, > myAppFileCreator,dmModeReadOnly); > > MenuCmdBarAddButton(menuCmdBarOnLeft,buttonBitmapID,menuCmdBarResultNotify,m > yNotifyConst,"My command button"); > DmCloseDatabase(dbP); > } > > With these codes, the bitmap for the button can't be drawn. > > I tried to leave the database opened by deleting the DmCloseDatabase. Then, > the button bitmap can be drawn, but when leaving the current form, error > occurs and it crashes. > > How do I know when the command bar is closing? When should I open and close > my database with the button bitmap? > > Thanks in advance! > > Regards, > Edmund > > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
