BOOL CViewDialog::OnInitDialog() { // Set the Icon SetIconLarge(IDW_MAIN); SetIconSmall(IDW_MAIN); // Attach CWnd objects to the dialog items AttachItem(IDC_BUTTON1, m_Button); AttachItem(IDC_CHECK1, m_CheckA); AttachItem(IDC_CHECK2, m_CheckB); AttachItem(IDC_CHECK3, m_CheckC); AttachItem(IDC_RADIO1, m_RadioA); AttachItem(IDC_RADIO2, m_RadioB); AttachItem(IDC_RADIO3, m_RadioC); AttachItem(IDC_RICHEDIT1, m_RichEdit1); AttachItem(IDC_RICHEDIT2, m_RichEdit2); // Put some text in the edit boxes m_RichEdit1.SetWindowText(_T("Rich Edit Window")); m_RichEdit2.SetWindowText(_T("Rich Edit Window")); // Initialize dialog resizing m_Resizer.Initialize( this, CRect(0, 0, 300, 200) ); m_Resizer.AddChild(m_RadioA, topleft, 0); m_Resizer.AddChild(m_RadioB, topleft, 0); m_Resizer.AddChild(m_RadioC, topleft, 0); m_Resizer.AddChild(m_Button, topleft, 0); m_Resizer.AddChild(m_CheckA, bottomright, 0); m_Resizer.AddChild(m_CheckB, bottomright, 0); m_Resizer.AddChild(m_CheckC, bottomright, 0); m_Resizer.AddChild(m_RichEdit1, topright, RD_STRETCH_WIDTH); m_Resizer.AddChild(m_RichEdit2, bottomleft, RD_STRETCH_WIDTH| RD_STRETCH_HEIGHT); return true; }
int CMDIChildMax::OnCreate(CREATESTRUCT& cs) { SetWindowText(_T("Maximised Window")); SetIconLarge(IDI_MAX); SetIconSmall(IDI_MAX); return CMDIChild::OnCreate(cs); }
int CMDIChildText::OnCreate(LPCREATESTRUCT pcs) { UNREFERENCED_PARAMETER(pcs); m_TextView.Create(this); SetWindowText(_T("Text Window")); SetIconLarge(IDI_TEXT); SetIconSmall(IDI_TEXT); return 0; }
int CMDIChildTreeView::OnCreate(LPCREATESTRUCT pcs) { UNREFERENCED_PARAMETER(pcs); m_TreeView.Create(this); SetWindowText(_T("Tree-View Window")); SetIconLarge(IDI_CLASSES); SetIconSmall(IDI_CLASSES); return 0; }
BOOL CMyDialog::OnInitDialog() { // Set the Icon SetIconLarge(IDW_MAIN); SetIconSmall(IDW_MAIN); // Attach the custom control to a CWnd object m_MyControl.AttachDlgItem(IDC_CUSTOMWEB, this); // Support automatic resizing m_Resizer.Initialize(this, CRect(0, 0, 300, 200)); m_Resizer.AddChild(m_MyControl, topleft, RD_STRETCH_WIDTH | RD_STRETCH_HEIGHT); return TRUE; }
BOOL CMyDialog::OnInitDialog() { // Set the Icon SetIconLarge(IDI_DIALOG); SetIconSmall(IDI_DIALOG); // Put some text in the edit boxes SetDlgItemText(IDC_EDIT1, _T("Edit Control")); SetDlgItemText(IDC_RICHEDIT1, _T("Rich Edit Window")); // Put some text in the list box for (int i = 0 ; i < 8 ; i++) SendDlgItemMessage(IDC_LIST1, LB_ADDSTRING, 0, (LPARAM) _T("List Box")); return true; }
BOOL CMyDialog::OnInitDialog() { // Set the Icon SetIconLarge(IDW_MAIN); SetIconSmall(IDW_MAIN); // Put some text in the edit boxes ::SetDlgItemText(GetHwnd(), IDC_EDIT1, TEXT("Edit Control")); // Turn our button into a MyButton object m_Button.AttachDlgItem(IDC_BUTTON2, this); // Turn our static control into a hyperlink m_Hyperlink.AttachDlgItem(IDC_STATIC4, this); return true; }
BOOL CMyDialog::OnInitDialog() { // Set the Icon SetIconLarge(IDW_MAIN); SetIconSmall(IDW_MAIN); // Put some text in the edit boxes SetDlgItemText(IDC_EDIT1, _T("Edit Control")); SetDlgItemText(IDC_RICHEDIT1, _T("Rich Edit Window")); // Put some text in the list box AttachItem(IDC_LIST1, m_ListBox); for (int i = 0 ; i < 8 ; i++) m_ListBox.AddString(_T("List Box")); // Turn our button into a MyButton object AttachItem(IDC_BUTTON2, m_Button); // Turn our static control into a hyperlink AttachItem(IDC_STATIC4, m_Hyperlink); return TRUE; }
int CView::OnCreate(LPCREATESTRUCT pcs) { // OnCreate is called automatically during window creation when a // WM_CREATE message received. // Tasks such as setting the icon, creating child windows, or anything // associated with creating windows are normally performed here. UNREFERENCED_PARAMETER(pcs); // Set the window's icon SetIconSmall(IDW_MAIN); SetIconLarge(IDW_MAIN); SetWindowText(LoadString(IDW_MAIN).c_str()); // Window title TRACE("OnCreate\n"); return 0; }
BOOL CAboutDialog::OnInitDialog() { SetIconLarge(IDI_APPICON); SetIconSmall(IDI_APPICON); m_icon = (HICON)::LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, 48, 48, LR_DEFAULTCOLOR); HFONT l_defaultFont = (HFONT)SendMessage(WM_GETFONT); if(!l_defaultFont) l_defaultFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT); const int l_left = 70; int l_top = 15; std::wstring l_verStr = L"iNFekt v" + m_mainWin->InfektVersionAsString(); #ifndef COMPACT_RELEASE #ifdef _WIN64 l_verStr += L" (64 bit)"; #else if(CUtilWin32::IsWow64()) l_verStr += L" (WoW64)"; else l_verStr += L" (32 bit)"; #endif #endif const std::wstring winVerName = GetWindowsClientOSName(); if (CUtilWin32::IsWinServerOS()) { l_verStr += L" on Windows Server"; if (!winVerName.empty()) l_verStr += L" (like Win " + winVerName + L")"; } else if (!winVerName.empty()) l_verStr += L" on Windows " + winVerName; _CREATE_STATIC(l_hTitle, l_verStr, l_top, 20); l_top += 20; #ifdef COMPACT_RELEASE _CREATE_STATIC(l_hSubTitle, L"Super Compact Version", l_top, 20); l_top += 20; #endif if(l_hTitle) { LOGFONT l_tmpFont; ::GetObject(l_defaultFont, sizeof(LOGFONT), &l_tmpFont); l_tmpFont.lfWeight = FW_BOLD; m_boldFont = ::CreateFontIndirect(&l_tmpFont); ::SendMessage(l_hTitle, WM_SETFONT, (WPARAM)m_boldFont, 1); #ifdef COMPACT_RELEASE if(l_hSubTitle) ::SendMessage(l_hSubTitle, WM_SETFONT, (WPARAM)m_boldFont, 1); #endif } _CREATE_STATIC(l_hCopyright, L"\xA9 syndicode 2010-2015", l_top, 20); l_top += 20; _CREATE_SYSLINK(l_hHomepage, L"Project Homepage: <A HREF=\"http://infekt.ws/\">infekt.ws</A>", l_top, 20); m_linkCtrl = l_hHomepage; l_top += 20; const wchar_t* l_gpuFlag = L"no"; if(CCairoBoxBlur::IsGPUUsable()) { l_gpuFlag = CNFORenderer::GetGlobalUseGPUFlag() ? L"yes" : L"disabled"; } _CREATE_STATIC(l_hLibVersions, FORMAT(L"Using Cairo v%d.%d.%d, PCRE v%d.%02d, GPU: %s", CAIRO_VERSION_MAJOR % CAIRO_VERSION_MINOR % CAIRO_VERSION_MICRO % PCRE_MAJOR % PCRE_MINOR % l_gpuFlag), l_top, 20); l_top += 20; _CREATE_STATIC(l_hGPL, L"This program is free software; you can redistribute it and/or " L"modify it under the terms of the GNU General Public License " L"as published by the Free Software Foundation.", l_top, 55); l_top += 60; return TRUE; }