Hi group

I've already written some small apps, some with quite a number of dialogs
and they all got their own menu.

Now I'm working on a today plugin which has an own options dialog. My
problem: I set it up to show the dialog when I tap on its area on the today
screen. But then the dialog has no command bar, thus no SIP as well. But
when I open the dialog through Settings->Today->Items there is such a bar
with a SIP.

Could you please tell me what I'm doing wrong? I'd like to get a commandbar
which provides a SIP to enter settings.


Following is an excerpt from my options dialog procedure. I use the same
code in my other apps (that is, in dialogs that are opened within the
apps), where it works. Is there something evidently wrong here?

case WM_INITDIALOG:
SHINITDLGINFO shidi;
shidi.dwMask=SHIDIM_FLAGS;
shidi.hDlg=hDlg; // hDlg comes from function interface
shidi.dwFlags=SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN;
SHInitDialog(&shidi);

hwndCB=CreateRpCommandBar(hDlg,IDM_OPTIONS);
hMenu=(HMENU)SendMessage(hwndCB,SHCMBM_GETMENU,(WPARAM)0,(LPARAM)0);
break;

hwndCB and hMenu are defined within the function as a static HWND and
HMENU, respectively. The menu resource IDM_OPTIONS exists, of course ;-)

The only difference I can think of is that in my other apps I have an own
main window which already brings along a commandbar in which the dialog's
menu is placed, whereas a today item's "main window" is embedded in the
today screen and therefore doesn't have that bar.

I'd apreciate any helpful answers.
--
Gruß | Greetings | Qapla'
Quoting can be so easy: http://www.netmeister.org/news/learn2quote.html

RE: How to get a command bar in my today item's dialog by dbgrick

dbgrick
Wed Dec 05 06:59:02 PST 2007

In your WM_INITDIALOG event, create the menu bar. There is sample code:
SHMENUBARINFO m_mbi;

// initialize menubar
ZeroMemory (&m_mbi, sizeof(m_mbi));
m_mbi.cbSize = sizeof(m_mbi);
m_mbi.hwndParent = hWnd; // handle to form
m_mbi.nToolBarId = ID_OF_MENU_RESOURCE;
m_mbi.hInstRes = hInstance; // Application instance handle

// Create the dialog menu
if (!SHCreateMenuBar (&m_mbi))return FALSE;

I hope this helps.

Regards,
Rick D.
Contractor

"Frank Steinmetzger" wrote:

> Hi group
>
> I've already written some small apps, some with quite a number of dialogs
> and they all got their own menu.
>
> Now I'm working on a today plugin which has an own options dialog. My
> problem: I set it up to show the dialog when I tap on its area on the today
> screen. But then the dialog has no command bar, thus no SIP as well. But
> when I open the dialog through Settings->Today->Items there is such a bar
> with a SIP.
>
> Could you please tell me what I'm doing wrong? I'd like to get a commandbar
> which provides a SIP to enter settings.
>
>
> Following is an excerpt from my options dialog procedure. I use the same
> code in my other apps (that is, in dialogs that are opened within the
> apps), where it works. Is there something evidently wrong here?
>
> case WM_INITDIALOG:
> SHINITDLGINFO shidi;
> shidi.dwMask=SHIDIM_FLAGS;
> shidi.hDlg=hDlg; // hDlg comes from function interface
> shidi.dwFlags=SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN;
> SHInitDialog(&shidi);
>
> hwndCB=CreateRpCommandBar(hDlg,IDM_OPTIONS);
> hMenu=(HMENU)SendMessage(hwndCB,SHCMBM_GETMENU,(WPARAM)0,(LPARAM)0);
> break;
>
> hwndCB and hMenu are defined within the function as a static HWND and
> HMENU, respectively. The menu resource IDM_OPTIONS exists, of course ;-)
>
> The only difference I can think of is that in my other apps I have an own
> main window which already brings along a commandbar in which the dialog's
> menu is placed, whereas a today item's "main window" is embedded in the
> today screen and therefore doesn't have that bar.
>
> I'd apreciate any helpful answers.
> --
> GruÃ? | Greetings | Qapla'
> Quoting can be so easy: http://www.netmeister.org/news/learn2quote.html
>