Windows Mobile平台上重写Back健的行为
2010-08-22 12:56:00 来源:WEB开发网SHINITDLGINFO shidi;
ZeroMemory(&shidi, sizeof(shidi));
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;
shidi.hDlg = hDlg;
// set up Soft Keys menu
SHMENUBARINFO mbi;
ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hDlg;
mbi.nToolBarId = nToolBarId;
mbi.hInstRes = g_hInst;
// If we could not initialize the dialog box, return an error
if (FALSE == (SHInitDialog(&shidi) && SHCreateMenuBar(&mbi)))
{
return FALSE;
}
// set the title bar
SetWindowText(hDlg, tszTitle);
// In order to make Back work properly, it's necessary to
// override it and then call the appropriate SH API
(void)SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK,
MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
SHMBOF_NODEFAULT | SHMBOF_NOTIFY));
return TRUE;
}
//
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
BOOL CALLBACK DlgProc (
HWND hwnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
BOOL bReturn = TRUE;
switch(Msg)
{
case WM_INITDIALOG:
// Initialize the dialog and softkey menu
if (FALSE == InitWindow(hwnd, IDR_BACK_MENUBAR))
{
EndDialog(hwnd, -1);
}
break;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
EndDialog(hwnd,IDOK);
break;
default:
bReturn = FALSE;
}
break;
case WM_HOTKEY:
更多精彩
赞助商链接