Exemple #1
0
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg,
        WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
        case WM_CREATE:
            OleInitialize(NULL);
            PaneRegisterClassW();
            TypeLibRegisterClassW();
            if(!CreatePanedWindow(hWnd, &globals.hPaneWnd, globals.hMainInst))
                PostQuitMessage(0);
            SetLeft(globals.hPaneWnd, CreateTreeWindow(globals.hMainInst));
            SetRight(globals.hPaneWnd, CreateDetailsWindow(globals.hMainInst));
            SetFocus(globals.hTree);
            break;
        case WM_COMMAND:
            MenuCommand(LOWORD(wParam), hWnd);
            break;
        case WM_DESTROY:
            OleUninitialize();
            EmptyTree();
            PostQuitMessage(0);
            break;
        case WM_MENUSELECT:
            UpdateStatusBar(LOWORD(wParam));
            break;
        case WM_SETFOCUS:
            SetFocus(globals.hTree);
            break;
        case WM_SIZE:
            if(wParam == SIZE_MINIMIZED) break;
            ResizeChild();
            break;
        default:
            return DefWindowProcW(hWnd, uMsg, wParam, lParam);
    }
    return 0;
}
Exemple #2
0
int CTaskPane::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CMFCTasksPane::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	SetIconsList (IDB_TASKS, 16);
	
	SetCaption (_T("Tasks Pane"));
	SetPageCaption (0, _T("New document"));

	m_nDocumentsGroup = AddGroup (_T("Open a document"), FALSE, TRUE);

	// Add MRU list
	AddMRUFilesList (m_nDocumentsGroup);
	AddTask (m_nDocumentsGroup, _T("More Documents..."), 0, ID_FILE_OPEN);

	int nPage1Gr2 = AddGroup (_T("New"));

	AddTask (nPage1Gr2, _T("Blank Document"), 1, ID_FILE_NEW);

	AddTask (nPage1Gr2, _T("Blank Web Page"), 2, ID_DUMMY);
	AddSeparator (nPage1Gr2);
	AddTask (nPage1Gr2, _T("Blank E-mail message"), 3, ID_DUMMY);

	int nPage1Gr3 = AddGroup (_T("New from existing document"));

	AddTask (nPage1Gr3, _T("Choose document..."), 4, ID_DUMMY);

	int nPage1Gr4 = AddGroup (_T("New from template"));

	AddTask (nPage1Gr4, _T("General Templates..."), 5, ID_DUMMY);
	AddTask (nPage1Gr4, _T("Templates on my Web Sites..."), 6, ID_DUMMY);
	AddTask (nPage1Gr4, _T("Templates on Microsoft.com..."), 7, ID_DUMMY);

	int nPage1Gr5 = AddGroup (_T(""), TRUE /* Group at bottom */);

	AddTask (nPage1Gr5, _T("Add Network Place..."), 8, ID_DUMMY);
	AddTask (nPage1Gr5, _T("Help..."), 9, ID_DUMMY);
	AddLabel (nPage1Gr5, _T("Label"));

	//--------
	// Page 2:
	//--------
	int nPage2 = AddPage (_T("Basic Search"));

	int nPage2Gr1 = AddGroup (nPage2, _T("Search for:"));

	AddTask (nPage2Gr1, _T("Search Tips..."), 9, ID_DUMMY);

	int nPage2Gr3 = AddGroup (nPage2, _T("See also:"));

	AddTask (nPage2Gr3, _T("Advanced Search"), 9, ID_DUMMY);
	AddTask (nPage2Gr3, _T("Find in this document..."), 9, ID_DUMMY);

	//--------
	// Page 3:
	//--------
	int nPage3 = AddPage (_T("Custom page"));

	int nPage3Gr1 = AddGroup (nPage3, _T("Folders"));

	if (!CreateTreeWindow())
	{
		TRACE0("Failed to create the custom window\n");
		return -1;      // fail to create
	}

	AddWindow (nPage3Gr1, m_wndTree.GetSafeHwnd (), 65);
	AddTask (nPage3Gr1, _T("My favorites..."), 0, ID_DUMMY);

	int nPage3Gr2 = AddGroup (nPage3, _T("Enter your text"));

	CRect rectDummy;
	rectDummy.SetRectEmpty ();
	DWORD dwEditStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | 
		ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_WANTRETURN;
	m_Font.CreateStockObject (DEFAULT_GUI_FONT);
	if (!m_wndEdit.Create (dwEditStyle, rectDummy, this, (UINT)-1))
	{
		TRACE0("Failed to create the edit window\n");
		return -1;      // fail to create
	}
	m_wndEdit.SetFont (&m_Font);
	m_wndEdit.SetWindowText(
		_T("This is the standard multiline Edit Box.\r\nHere you can type your text."));
	
	AddWindow (nPage3Gr2, m_wndEdit.GetSafeHwnd (), 65);
	return 0;
}