// [!output DIALOG_IMPL] : Implementierungsdatei // #include "stdafx.h" #include "[!output APP_HEADER]" #include "[!output DIALOG_HEADER]" [!if AUTOMATION] #include "[!output DIALOG_AUTO_PROXY_HEADER]" [!endif] #ifdef _DEBUG #define new DEBUG_NEW #endif [!if ABOUT_BOX] // CAboutDlg-Dialogfeld für Anwendungsbefehl "Info" class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialogfelddaten enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung // Implementierung protected: DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { [!if ACCESSIBILITY] EnableActiveAccessibility(); [!endif] } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) END_MESSAGE_MAP() [!endif] // [!output DIALOG_CLASS]-Dialogfeld [!if HTML_DIALOG] BEGIN_DHTML_EVENT_MAP([!output DIALOG_CLASS]) DHTML_EVENT_ONCLICK(_T("ButtonOK"), OnButtonOK) DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel) [!if CONTEXT_HELP] DHTML_EVENT_ONCLICK(_T("ButtonHelp"), OnButtonHelp) [!endif] END_DHTML_EVENT_MAP() [!endif] [!if AUTOMATION] IMPLEMENT_DYNAMIC([!output DIALOG_CLASS], [!output DIALOG_BASE_CLASS]); [!endif] [!output DIALOG_CLASS]::[!output DIALOG_CLASS](CWnd* pParent /*=NULL*/) [!if HTML_DIALOG] : CDHtmlDialog([!output DIALOG_CLASS]::IDD, [!output DIALOG_CLASS]::IDH, pParent) [!else] : [!output DIALOG_BASE_CLASS]([!output DIALOG_CLASS]::IDD, pParent) [!endif] { [!if ACCESSIBILITY] EnableActiveAccessibility(); [!endif] m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); [!if AUTOMATION] m_pAutoProxy = NULL; [!endif] } [!if AUTOMATION] [!output DIALOG_CLASS]::~[!output DIALOG_CLASS]() { // Existiert für dieses Dialogfeld ein Automatisierungsproxy, setzen Sie // seinen Gegenzeiger auf dieses Dialogfeld auf NULL, um anzuzeigen, // dass das Dialogfeld gelöscht wurde. if (m_pAutoProxy != NULL) m_pAutoProxy->m_pDialog = NULL; } [!endif] void [!output DIALOG_CLASS]::DoDataExchange(CDataExchange* pDX) { [!output DIALOG_BASE_CLASS]::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP([!output DIALOG_CLASS], [!output DIALOG_BASE_CLASS]) [!if ABOUT_BOX] ON_WM_SYSCOMMAND() [!endif] [!if CONTEXT_HELP && HELPSTYLE_WINHELP] ON_WM_DESTROY() [!endif] [!if AUTOMATION] ON_WM_CLOSE() [!endif] [!if !HTML_DIALOG] ON_WM_PAINT() ON_WM_QUERYDRAGICON() [!endif] //}}AFX_MSG_MAP END_MESSAGE_MAP() // [!output DIALOG_CLASS]-Meldungshandler BOOL [!output DIALOG_CLASS]::OnInitDialog() { [!output DIALOG_BASE_CLASS]::OnInitDialog(); [!if ABOUT_BOX] // Hinzufügen des Menübefehls "Info..." zum Systemmenü. // IDM_ABOUTBOX muss sich im Bereich der Systembefehle befinden. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } [!endif] // Symbol für dieses Dialogfeld festlegen. Wird automatisch erledigt // wenn das Hauptfenster der Anwendung kein Dialogfeld ist SetIcon(m_hIcon, TRUE); // Großes Symbol verwenden SetIcon(m_hIcon, FALSE); // Kleines Symbol verwenden [!if MAIN_FRAME_MAXIMIZED] ShowWindow(SW_MAXIMIZE); [!endif] [!if MAIN_FRAME_MINIMIZED] ShowWindow(SW_MINIMIZE); [!endif] // TODO: Hier zusätzliche Initialisierung einfügen return TRUE; // Geben Sie TRUE zurück, außer ein Steuerelement soll den Fokus erhalten } [!if ABOUT_BOX] void [!output DIALOG_CLASS]::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { [!output DIALOG_BASE_CLASS]::OnSysCommand(nID, lParam); } } [!endif] [!if CONTEXT_HELP && HELPSTYLE_WINHELP] void [!output DIALOG_CLASS]::OnDestroy() { WinHelp(0L, HELP_QUIT); [!output DIALOG_BASE_CLASS]::OnDestroy(); } [!endif] // Wenn Sie dem Dialogfeld eine Schaltfläche "Minimieren" hinzufügen, benötigen Sie // den nachstehenden Code, um das Symbol zu zeichnen. Für MFC-Anwendungen, die das // Dokument/Ansicht-Modell verwenden, wird dies automatisch ausgeführt. void [!output DIALOG_CLASS]::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // Gerätekontext zum Zeichnen SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); // Symbol in Clientrechteck zentrieren int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Symbol zeichnen dc.DrawIcon(x, y, m_hIcon); } else { [!output DIALOG_BASE_CLASS]::OnPaint(); } } // Die System ruft diese Funktion auf, um den Cursor abzufragen, der angezeigt wird, während der Benutzer // das minimierte Fenster mit der Maus zieht. HCURSOR [!output DIALOG_CLASS]::OnQueryDragIcon() { return static_cast(m_hIcon); } [!if AUTOMATION] // Automatisierungsserver sollten nicht beendet werden, wenn der Benutzer // das UI schließt und ein Controller eines seiner Objekte nicht freigibt. // Diese Nachrichtenhandler stellen sicher, dass // das UI ausgeblendet wird, das Dialogfeld beim Schließen aber erhalten bleibt, wenn der Proxy // noch verwendet wird. void [!output DIALOG_CLASS]::OnClose() { if (CanExit()) [!output DIALOG_BASE_CLASS]::OnClose(); } void [!output DIALOG_CLASS]::OnOK() { if (CanExit()) [!output DIALOG_BASE_CLASS]::OnOK(); } void [!output DIALOG_CLASS]::OnCancel() { if (CanExit()) [!output DIALOG_BASE_CLASS]::OnCancel(); } BOOL [!output DIALOG_CLASS]::CanExit() { // Wenn das Proxy-Objekt noch vorhanden ist, gibt der Automatisierungscontroller // diese Anwendung nicht frei. Blenden Sie nur // die Benutzeroberfläche des Dialogfelds aus. if (m_pAutoProxy != NULL) { ShowWindow(SW_HIDE); return FALSE; } return TRUE; } [!endif] [!if HTML_DIALOG] HRESULT [!output DIALOG_CLASS]::OnButtonOK(IHTMLElement* /*pElement*/) { OnOK(); return S_OK; } HRESULT [!output DIALOG_CLASS]::OnButtonCancel(IHTMLElement* /*pElement*/) { OnCancel(); return S_OK; } [!if CONTEXT_HELP] HRESULT [!output DIALOG_CLASS]::OnButtonHelp(IHTMLElement* /*pElement*/) { OnHelp(); return S_OK; } [!endif] [!endif]