/****************************************************************************
*
*     FUNCTION: WndProc
*
*     PURPOSE:  Window Procedure for the main window.
*
*     PARAMS:   HWND   hWnd    - This window
*               UINT   Message - Which message?
*               WPARAM wParam  - message parameter
*               LPARAM lParam  - message parameter
*
*     RETURNS:  LRESULT - depends on message
*
* History:
*                July '95 - Created
*
\****************************************************************************/
LRESULT CALLBACK WndProc( HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam )
{
    // which message are we handling?
    switch( Message )
    {
        // Menu is coming up, initialize it
        case WM_INITMENU:
            UpdateMenuState( hWnd, (HMENU)wParam );
            return 1;
        break; // end WM_INITMENU

        // Window is being created, create the MDI client also
        case WM_CREATE:
        {
            CLIENTCREATESTRUCT ccs;

            // Retrieve the handle of the Window menu and assign the
            // first child window identifier.
            ccs.hWindowMenu = GetSubMenu(GetMenu(hWnd), 2 );
            ccs.idFirstChild = IDM_WINDOWCHILD;

            // Create the MDI client window
            hMDIClientWnd = CreateWindow(	TEXT("MDICLIENT"), (LPCTSTR) NULL,
                                            WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
                                            0, 0, 0, 0, hWnd, (HMENU) 0xCAC, hInst, (LPSTR) &ccs );

            ShowWindow(hMDIClientWnd, SW_SHOW);
        }
        break; // End WM_CREATE

        // Command Messages (menu items, etc)
        case WM_COMMAND:
            OnCommand( hWnd, wParam, lParam );
            return DefFrameProc( hWnd, hMDIClientWnd, Message, wParam, lParam );
        break; // End WM_COMMAND

        // Time to close down now :(
        case WM_CLOSE:
        {
            // Will the children allow it? (Give 'em a chance to cancel)
            if( QueryCloseAllChildren() )
            {
                WinHelp( hWnd, szHelpFileName, HELP_QUIT, 0 );
                DestroyWindow( hWnd );
                PostQuitMessage( 0 );
                return DefFrameProc( hWnd, hMDIClientWnd, Message, wParam, lParam );
            }
            return 0;
        }
        break; // End WM_CLOSE

        // Pass it on to the default window procedure
        default:
            return DefFrameProc( hWnd, hMDIClientWnd, Message, wParam, lParam );
        break; // end default
    }
    return DefFrameProc( hWnd, hMDIClientWnd, Message, wParam, lParam );
}
void CFeedIcoItemListCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
	// TODO: 在此处添加消息处理程序代码
	CTitleMenu	menuRSS;
	menuRSS.CreatePopupMenu();

	menuRSS.AppendMenu(MF_STRING,MP_OPEN,GetResString(IDS_OPEN),_T("OPEN"));
	menuRSS.AppendMenu(MF_STRING,MP_OPENFOLDER, GetResString(IDS_OPENFOLDER), _T("OPENFOLDER"));
	//menuRSS.AppendMenu(MF_STRING|MF_SEPARATOR);
	menuRSS.AppendMenu(MF_STRING,MP_DOWNLOAD_ALL, GetResString(IDS_RSSBTN_ALLDL), _T("RESUME"));//下载所有
	menuRSS.AppendMenu(MF_STRING, MP_RESUME, GetResString(IDS_DOWNLOAD), _T("RESUME"));
	menuRSS.AppendMenu(MF_STRING, MP_PAUSE, GetResString(IDS_PAUSE), _T("PAUSE"));
	menuRSS.AppendMenu(MF_STRING,MP_CANCEL, GetResString(IDS_DELETE_FILE), _T("DELETE"));
	//menuRSS.AppendMenu(MF_STRING|MF_SEPARATOR);
	menuRSS.AppendMenu(MF_STRING,MP_REFRESH, GetResString(IDS_SV_UPDATE), NULL );
	menuRSS.AppendMenu(MF_STRING,MP_OPTIONS, GetResString(IDS_RW_RSS_CONFIG), NULL );
	//menuRSS.AppendMenu(MF_STRING, MP_STOP, GetResString(IDS_DL_STOP), _T("STOP"));

	menuRSS.EnableMenuItem(MP_OPEN, MF_GRAYED);
	menuRSS.EnableMenuItem(MP_OPENFOLDER, MF_GRAYED);
	menuRSS.EnableMenuItem(MP_DOWNLOAD_ALL, MF_GRAYED);
	menuRSS.EnableMenuItem(MP_RESUME, MF_GRAYED);
	menuRSS.EnableMenuItem(MP_PAUSE, MF_GRAYED);
	menuRSS.EnableMenuItem(MP_CANCEL, MF_GRAYED);
	menuRSS.EnableMenuItem(MP_REFRESH, MF_GRAYED);
	menuRSS.EnableMenuItem(MP_OPTIONS, MF_GRAYED);
	//menuRSS.EnableMenuItem(MP_STOP, MF_GRAYED);

	UpdateMenuState(menuRSS);

	m_pMenuXP = new CMenuXP();
	m_pMenuXP->AddMenu(&menuRSS, TRUE);
	menuRSS.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, this);
	menuRSS.DestroyMenu();

	delete m_pMenuXP;
	m_pMenuXP = NULL;
}