/* * ColorDialogProc: Allow user to select foreground & background colors. */ BOOL CALLBACK ColorDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static ColorDialogStruct *info; static HWND hSample; static COLORREF temp_fg, temp_bg; int ctrl; CHOOSECOLOR cc; HDC hdc; switch (message) { case WM_INITDIALOG: info = (ColorDialogStruct *) lParam; temp_fg = GetColor(info->fg); temp_bg = GetColor(info->bg); hSample = GetDlgItem(hDlg, IDC_SAMPLETEXT); CenterWindow(hDlg, hMain); return TRUE; case WM_PAINT: hdc = GetDC(hSample); SelectPalette(hdc, hPal, FALSE); SetTextColor(hdc, temp_fg); SetBkColor(hdc, temp_bg); InvalidateRect(hSample, NULL, TRUE); UpdateWindow(hSample); SelectObject(hdc, GetFont(FONT_TITLES)); TextOut(hdc, 0, 0, szAppName, strlen(szAppName)); ReleaseDC(hSample, hdc); break; case WM_COMMAND: switch(ctrl = GET_WM_COMMAND_ID(wParam, lParam)) { case IDC_BACKGROUND: case IDC_FOREGROUND: memset(&cc, 0, sizeof(CHOOSECOLOR)); cc.lStructSize = sizeof(CHOOSECOLOR); cc.hwndOwner = hDlg; cc.rgbResult = (ctrl == IDC_FOREGROUND) ? temp_fg : temp_bg; cc.lpCustColors = CustColors; cc.Flags = CC_RGBINIT | CC_FULLOPEN; if (ChooseColor(&cc) == 0) return TRUE; /* Set new color */ if (ctrl == IDC_FOREGROUND) temp_fg = MAKEPALETTERGB(cc.rgbResult); else temp_bg = MAKEPALETTERGB(cc.rgbResult); /* Redraw to see new colors */ InvalidateRect(hDlg, NULL, TRUE); return TRUE; case IDOK: /* Save user's choices */ SetColor(info->fg, temp_fg); SetColor(info->bg, temp_bg); MainChangeColor(); EndDialog(hDlg, IDOK); return TRUE; case IDCANCEL: EndDialog(hDlg, IDCANCEL); return TRUE; } } return FALSE; }
/* * ClientMsgBoxProc: A substitute implementation of MessageBox's window procedure. * We have 2 OK buttons and 2 Cancel buttons, to account for the case where one * or the other is the default button. We hide the buttons we don't need. */ BOOL CALLBACK ClientMsgBoxProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { static MsgBoxStruct *s; char *icon = NULL, *temp; int style, button_style, num_lines, yincrease; HICON hIcon; HWND hEdit, hText; HWND hOK, hCancel, hOK2, hCancel2; HFONT hFont; RECT dlg_rect, edit_rect; switch (message) { case WM_ACTIVATE: CenterWindow(hDlg, GetParent(hDlg)); break; case WM_SETFOCUS: case WM_WINDOWPOSCHANGING: SetFocus(hDlg); break; case WM_INITDIALOG: s = (MsgBoxStruct *) lParam; button_style = s->style & MB_TYPEMASK; hText = GetDlgItem(hDlg, IDC_TEXT); hOK = GetDlgItem(hDlg, IDOK); hCancel = GetDlgItem(hDlg, IDCANCEL); hOK2 = GetDlgItem(hDlg, IDOK2); hCancel2 = GetDlgItem(hDlg, IDCANCEL2); // Display text // Put text in invisible edit box to see how much space it will take hEdit = GetDlgItem(hDlg, IDC_EDIT); hFont = GetWindowFont(hText); SetWindowFont(hEdit, hFont, TRUE); SetWindowFont(hOK, hFont, FALSE); SetWindowFont(hCancel, hFont, FALSE); SetWindowFont(hOK2, hFont, FALSE); SetWindowFont(hCancel2, hFont, FALSE); SetWindowText(hEdit, s->text); Edit_GetRect(hEdit, &edit_rect); num_lines = Edit_GetLineCount(hEdit); // Count blank lines separately, since edit box not handling them correctly temp = s->text; do { temp = strstr(temp, "\n\n"); if (temp != NULL) { num_lines++; temp += 2; } } while (temp != NULL); yincrease = GetFontHeight(hFont) * num_lines; // Resize dialog and text area GetWindowRect(hDlg, &dlg_rect); MoveWindow(hDlg, dlg_rect.left, dlg_rect.top, dlg_rect.right - dlg_rect.left, dlg_rect.bottom - dlg_rect.top + yincrease, FALSE); ResizeDialogItem(hDlg, hText, &dlg_rect, RDI_ALL, False); // Move buttons; center OK button if it's the only one if (button_style == MB_OK) { ResizeDialogItem(hDlg, hOK, &dlg_rect, RDI_BOTTOM | RDI_HCENTER, False); ShowWindow(hCancel, SW_HIDE); ShowWindow(hCancel2, SW_HIDE); } else { ResizeDialogItem(hDlg, hOK, &dlg_rect, RDI_BOTTOM, False); ResizeDialogItem(hDlg, hCancel, &dlg_rect, RDI_BOTTOM, False); ResizeDialogItem(hDlg, hOK2, &dlg_rect, RDI_BOTTOM, False); ResizeDialogItem(hDlg, hCancel2, &dlg_rect, RDI_BOTTOM, False); } SetWindowText(hDlg, s->title); SetWindowText(hText, s->text); ShowWindow(hEdit, SW_HIDE); // Set icon to appropriate system icon style = s->style & MB_ICONMASK; if (style == MB_ICONSTOP) icon = IDI_HAND; else if (style == MB_ICONINFORMATION) icon = IDI_ASTERISK; else if (style == MB_ICONEXCLAMATION) icon = IDI_EXCLAMATION; else if (style == MB_ICONQUESTION) icon = IDI_QUESTION; if (icon != NULL) { hIcon = LoadIcon(NULL, icon); Static_SetIcon(GetDlgItem(hDlg, IDC_MSGBOXICON), hIcon); } // Display correct button text switch (button_style) { case MB_YESNO: SetWindowText(hOK, GetString(hInst, IDS_YES)); SetWindowText(hCancel, GetString(hInst, IDS_NO)); SetWindowText(hOK2, GetString(hInst, IDS_YES)); SetWindowText(hCancel2, GetString(hInst, IDS_NO)); break; } // Show correct button as default style = s->style & MB_DEFMASK; switch (style) { case MB_DEFBUTTON1: default: SetFocus(hOK); ShowWindow(hOK2, SW_HIDE); ShowWindow(hCancel, SW_HIDE); break; case MB_DEFBUTTON2: SetFocus(hCancel); ShowWindow(hOK, SW_HIDE); ShowWindow(hCancel2, SW_HIDE); break; } CenterWindow(hDlg, GetParent(hDlg)); return 0; case WM_COMMAND: switch(GET_WM_COMMAND_ID(wParam, lParam)) { case IDOK: case IDOK2: button_style = s->style & MB_TYPEMASK; if (button_style == MB_YESNO) EndDialog(hDlg, IDYES); else EndDialog(hDlg, IDOK); return TRUE; case IDCANCEL: case IDCANCEL2: button_style = s->style & MB_TYPEMASK; if (button_style == MB_YESNO) EndDialog(hDlg, IDNO); else EndDialog(hDlg, IDCANCEL); return TRUE; } break; } return FALSE; }
BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); SetFolderPath(); //skin CString sSkinPath; sSkinPath.Format("%s\\skin.bmp",m_sFolderPath); m_hBmp = (HBITMAP)LoadImage(AfxGetInstanceHandle(),sSkinPath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE); m_bFirst = TRUE; //inisialisasi database CString sDBPath; m_pDb = new CADODatabase(); sDBPath.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s\\db\\tts.mdb;Persist Security Info=False",m_sFolderPath); if(m_pDb->Open(sDBPath)) { //inisialiasi backpropagation m_backpro.SetConnDB(m_pDb); //inisialiasi second positioning asymetric windowing m_spaw.SetConnDB(m_pDb); m_spaw.SetBackPro(&m_backpro); m_spaw.Initialize(WINDOWSIZE,CENTERWINDOWPOS,4000,0.01, 0.01,4000); //inisialisasi speech //inisialisai natural language m_NatLang.SetConnDB(m_pDb); m_NatLang.m_sFolderPath = m_sFolderPath; m_NatLang.SetSPAW(&m_spaw); //inisialisasi tiap dialog di memory m_pLearningDlg = new CLearningDlg; m_pLearningDlg->SetSPAW(&m_spaw); m_pLearningDlg->Create( IDD_LEARNING_DIALOG, &m_cMainPanel); m_pLearningDlg->ShowWindow(SW_HIDE); m_pKataDlg = new CKataDlg; m_pKataDlg->SetSPAW(&m_spaw); m_pKataDlg->SetDB(m_pDb); m_pKataDlg->Create( IDD_DATA_KATA, &m_cMainPanel); m_pKataDlg->ShowWindow(SW_HIDE); m_pPengecualianDlg = new CPengecualianDlg; m_pPengecualianDlg->SetDB(m_pDb); m_pPengecualianDlg->Create(IDD_DATA_PENGECUALIAN, &m_cMainPanel); m_pPengecualianDlg->ShowWindow(SW_HIDE); m_pSingkatanDlg = new CSingkatanDlg; m_pSingkatanDlg->SetDB(m_pDb); m_pSingkatanDlg->Create(IDD_DATA_SINGKATAN,&m_cMainPanel); m_pSingkatanDlg->ShowWindow(SW_HIDE); m_pPengucapanDlg = new CNETtalk2Dlg; m_pPengucapanDlg->SetNatLang(&m_NatLang); m_pPengucapanDlg->SetConnDB(m_pDb); m_pPengucapanDlg->Create(IDD_NETTALK2_DIALOG,&m_cMainPanel); m_pPengucapanDlg->ShowWindow(SW_SHOW); m_pPengucapanDlg->m_hLearning = m_pLearningDlg->m_hWnd; m_pPengucapanDlg->m_sFolderpath = m_sFolderPath; SetActiveDialog(m_pPengucapanDlg); SetStyle(); } else { MessageBox("Error dalam membuka database","NETtalk2",MB_OK); EndDialog(0); } SetWindowPos(&CWnd::wndTop,0,0,0,0,SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE); CenterWindow(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
INT_PTR CHelpFileMissingDialog::OnInitDialog() { CenterWindow(GetParent(m_hDlg),m_hDlg); return TRUE; }
/** * @brief WM_INITDIALOG handler of Machine State dialog. * @param hwnd - window handle. * @param hwndFocus - system-defined focus window. * @param lParam - user-defined parameter. * @return true to setup focus to system-defined control. */ static BOOL MachineStateDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) { lParam; hwndFocus; _ASSERTE(g_pResManager != NULL); if (g_pResManager->m_hBigAppIcon) SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)g_pResManager->m_hBigAppIcon); if (g_pResManager->m_hSmallAppIcon) SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)g_pResManager->m_hSmallAppIcon); CenterWindow(hwnd, GetParent(hwnd)); g_LayoutMgr.InitLayout(hwnd, g_arrMachineStateLayout, countof(g_arrMachineStateLayout)); HWND hwndProcessList = GetDlgItem(hwnd, IDC_PROCESS_LIST); ListView_SetExtendedListViewStyle(hwndProcessList, LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP); HWND hwndModuleList = GetDlgItem(hwnd, IDC_PROCESS_MODULES_LIST); ListView_SetExtendedListViewStyle(hwndModuleList, LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP); RECT rcList; GetClientRect(hwndProcessList, &rcList); rcList.right -= GetSystemMetrics(SM_CXHSCROLL); TCHAR szColumnTitle[64]; LVCOLUMN lvc; ZeroMemory(&lvc, sizeof(lvc)); lvc.mask = LVCF_TEXT | LVCF_WIDTH; lvc.pszText = szColumnTitle; lvc.cx = rcList.right / 5; LoadString(g_hInstance, IDS_COLUMN_PID, szColumnTitle, countof(szColumnTitle)); ListView_InsertColumn(hwndProcessList, CID_PROCESS_ID, &lvc); lvc.cx = rcList.right * 4 / 5; LoadString(g_hInstance, IDS_COLUMN_PROCESS, szColumnTitle, countof(szColumnTitle)); ListView_InsertColumn(hwndProcessList, CID_PROCESS_NAME, &lvc); lvc.cx = rcList.right / 2; LoadString(g_hInstance, IDS_COLUMN_MODULE, szColumnTitle, countof(szColumnTitle)); ListView_InsertColumn(hwndModuleList, CID_MODULE_NAME, &lvc); lvc.cx = rcList.right / 4; LoadString(g_hInstance, IDS_COLUMN_VERSION, szColumnTitle, countof(szColumnTitle)); ListView_InsertColumn(hwndModuleList, CID_MODULE_VERSION, &lvc); lvc.cx = rcList.right / 4; LoadString(g_hInstance, IDS_COLUMN_BASE, szColumnTitle, countof(szColumnTitle)); ListView_InsertColumn(hwndModuleList, CID_MODULE_BASE, &lvc); CEnumProcess::CProcessEntry ProcEntry; if (g_pEnumProc->GetProcessFirst(ProcEntry)) { LVITEM lvi; ZeroMemory(&lvi, sizeof(lvi)); lvi.mask = LVIF_TEXT | LVIF_PARAM; int iItemPos = 0; do { TCHAR szProcessID[64]; _ultot_s(ProcEntry.m_dwProcessID, szProcessID, countof(szProcessID), 10); lvi.iItem = iItemPos; lvi.pszText = szProcessID; lvi.lParam = ProcEntry.m_dwProcessID; ListView_InsertItem(hwndProcessList, &lvi); ListView_SetItemText(hwndProcessList, iItemPos, CID_PROCESS_NAME, ProcEntry.m_szProcessName); ++iItemPos; } while (g_pEnumProc->GetProcessNext(ProcEntry)); } // LVM_SETIMAGELIST resets header control image list g_ProcessListOrder.InitList(hwndProcessList); g_ModulesListOrder.InitList(hwndModuleList); return TRUE; }
LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CErrorReportSender* pSender = CErrorReportSender::GetInstance(); CCrashInfoReader* pCrashInfo = pSender->GetCrashInfo(); // Mirror this window if RTL language is in use. CString sRTL = pSender->GetLangStr(_T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { Utility::SetLayoutRTL(m_hWnd); } // Set dialog caption. SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("DlgCaption"))); // Center the dialog on the screen. CenterWindow(); HICON hIcon = NULL; // Get custom icon. hIcon = pCrashInfo->GetCustomIcon(); if(hIcon==NULL) { // Use default icon, if custom icon is not provided. hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)); } // Set window icon. SetIcon(hIcon, 0); // Get the first icon in the EXE image and use it for header. m_HeadingIcon = ExtractIcon(NULL, pCrashInfo->GetReport(0)->GetImageName(), 0); // If there is no icon in crashed EXE module, use default IDI_APPLICATION system icon. if(m_HeadingIcon == NULL) { m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); } // Init controls. m_statSubHeader = GetDlgItem(IDC_SUBHEADER); m_link.SubclassWindow(GetDlgItem(IDC_LINK)); m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_link.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("WhatDoesReportContain"))); m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO)); m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_linkMoreInfo.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("ProvideAdditionalInfo"))); m_statEmail = GetDlgItem(IDC_STATMAIL); m_statEmail.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("YourEmail"))); m_editEmail = GetDlgItem(IDC_EMAIL); m_editEmail.SetWindowText(pSender->GetCrashInfo()->GetPersistentUserEmail()); m_statDesc = GetDlgItem(IDC_DESCRIBE); m_statDesc.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("DescribeProblem"))); m_editDesc = GetDlgItem(IDC_DESCRIPTION); m_statIndent = GetDlgItem(IDC_INDENT); m_chkRestart = GetDlgItem(IDC_RESTART); CString sCaption; sCaption.Format(pSender->GetLangStr(_T("MainDlg"), _T("RestartApp")), pSender->GetCrashInfo()->m_sAppName); m_chkRestart.SetWindowText(sCaption); m_chkRestart.SetCheck(BST_CHECKED); m_chkRestart.ShowWindow(pSender->GetCrashInfo()->m_bAppRestart?SW_SHOW:SW_HIDE); m_statConsent = GetDlgItem(IDC_CONSENT); // Init font for consent string. LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 11; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); CFontHandle hConsentFont; hConsentFont.CreateFontIndirect(&lf); m_statConsent.SetFont(hConsentFont); // Set text of the static if(pSender->GetCrashInfo()->m_sPrivacyPolicyURL.IsEmpty()) m_statConsent.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("MyConsent2"))); else m_statConsent.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("MyConsent"))); // Init Privacy Policy link m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY)); m_linkPrivacyPolicy.SetHyperLink(pSender->GetCrashInfo()->m_sPrivacyPolicyURL); m_linkPrivacyPolicy.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("PrivacyPolicy"))); BOOL bShowPrivacyPolicy = !pSender->GetCrashInfo()->m_sPrivacyPolicyURL.IsEmpty(); m_linkPrivacyPolicy.ShowWindow(bShowPrivacyPolicy?SW_SHOW:SW_HIDE); m_statCrashRpt = GetDlgItem(IDC_CRASHRPT); m_statHorzLine = GetDlgItem(IDC_HORZLINE); // Init OK button m_btnOk = GetDlgItem(IDOK); m_btnOk.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("SendReport"))); // Init Cancel button m_btnCancel = GetDlgItem(IDC_CANCEL); if(pSender->GetCrashInfo()->m_bQueueEnabled) m_btnCancel.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("OtherActions"))); else m_btnCancel.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("CloseTheProgram"))); // If send procedure is mandatory... if(pSender->GetCrashInfo()->m_bSendMandatory) { // Hide Cancel button m_btnCancel.ShowWindow(SW_HIDE); // Remove Close button SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) & ~WS_SYSMENU); } // Init font for heading text memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 25; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); m_HeadingFont.CreateFontIndirect(&lf); // Init control positions m_Layout.SetContainerWnd(m_hWnd); m_Layout.Insert(m_linkMoreInfo); m_Layout.Insert(m_statIndent); m_Layout.Insert(m_statEmail, TRUE); m_Layout.Insert(m_editEmail, TRUE); m_Layout.Insert(m_statDesc, TRUE); m_Layout.Insert(m_editDesc, TRUE); m_Layout.Insert(m_chkRestart); m_Layout.Insert(m_statConsent); m_Layout.Insert(m_linkPrivacyPolicy); m_Layout.Insert(m_statCrashRpt); m_Layout.Insert(m_statHorzLine, TRUE); m_Layout.Insert(m_btnOk); m_Layout.Insert(m_btnCancel, TRUE); // By default, hide the email & description fields. // But user may override the default. ShowMoreInfo(pSender->GetCrashInfo()->m_bShowAdditionalInfoFields); // Create progress dialog m_dlgProgress.Create(m_hWnd); m_dlgProgress.Start(TRUE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); if(pLoop) { pLoop->AddMessageFilter(this); } UIAddChildWindowContainer(m_hWnd); return TRUE; }
BOOL CPrintingDialog::OnInitDialog() { SetWindowText(AfxGetAppName()); CenterWindow(); return CDialog::OnInitDialog(); }
LRESULT CLogTIDFilterEditDlg::OnInitDialog(HWND /*hwndFocus*/, LPARAM /*lp*/) { SetDlgItemText(IDC_EDIT_LOGTID, tp::cz(L"%u", m_filter->m_tid)); CenterWindow(); return 0; }
BOOL CSettings::OnInitDialog() { BOOL bResult = CTreePropSheet::OnInitDialog(); CAppUtils::MarkWindowAsUnpinnable(m_hWnd); SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon if (g_GitAdminDir.HasAdminDir(this->m_CmdPath.GetWinPath()) || g_GitAdminDir.IsBareRepo(this->m_CmdPath.GetWinPath())) { CString title; GetWindowText(title); SetWindowText(g_Git.m_CurrentDir + _T(" - ") + title); } CenterWindow(CWnd::FromHandle(hWndExplorer)); if (this->m_DefaultPage == _T("gitremote")) { this->SetActivePage(this->m_pGitRemote); this->m_pGitRemote->m_bNoFetch = true; } else if (this->m_DefaultPage == _T("gitconfig")) { this->SetActivePage(this->m_pGitConfig); } else if (this->m_DefaultPage == _T("gitcredential")) { this->SetActivePage(this->m_pGitCredential); } else if (this->m_DefaultPage == _T("main")) { this->SetActivePage(this->m_pMainPage); } else if (this->m_DefaultPage == _T("overlay")) { this->SetActivePage(this->m_pOverlayPage); } else if (this->m_DefaultPage == _T("overlays")) { this->SetActivePage(this->m_pOverlaysPage); } else if (this->m_DefaultPage == _T("overlayshandlers")) { this->SetActivePage(this->m_pOverlayHandlersPage); } else if (this->m_DefaultPage == _T("proxy")) { this->SetActivePage(this->m_pProxyPage); } else if (this->m_DefaultPage == _T("diff")) { this->SetActivePage(this->m_pProgsDiffPage); } else if (this->m_DefaultPage == _T("merge")) { this->SetActivePage(this->m_pProgsMergePage); } else if (this->m_DefaultPage == _T("alternativeeditor")) { this->SetActivePage(this->m_pProgsAlternativeEditor); } else if (this->m_DefaultPage == _T("look")) { this->SetActivePage(this->m_pLookAndFeelPage); } else if (this->m_DefaultPage == _T("dialog")) { this->SetActivePage(this->m_pDialogsPage); } else if (this->m_DefaultPage == _T("color1")) { this->SetActivePage(this->m_pColorsPage); } else if (this->m_DefaultPage == _T("color2")) { this->SetActivePage(this->m_pColorsPage2); } else if (this->m_DefaultPage == _T("color3")) { this->SetActivePage(this->m_pColorsPage3); } else if (this->m_DefaultPage == _T("save")) { this->SetActivePage(this->m_pSavedPage); } else if (this->m_DefaultPage == _T("advanced")) { this->SetActivePage(this->m_pAdvanced); } else if (this->m_DefaultPage == _T("blame")) { this->SetActivePage(this->m_pTBlamePage); } else if (g_GitAdminDir.HasAdminDir(this->m_CmdPath.GetWinPath()) || g_GitAdminDir.IsBareRepo(this->m_CmdPath.GetWinPath())) { this->SetActivePage(this->m_pGitConfig); } return bResult; }
BOOL CHttpDownloadDlg::OnInitDialog() { //Let the parent class do its thing CDialog::OnInitDialog(); m_bgImage.LoadFromResource(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2)); if(!m_bgImage.IsNull()) { MoveWindow(0,0,m_bgImage.GetWidth(),m_bgImage.GetHeight()); CenterWindow(); } //Setup the animation control //m_ctrlAnimate.Open(IDR_HTTPDOWNLOAD_ANIMATION); m_ctrlAnimate.ShowWindow(SW_HIDE); m_static.SetMyText("游戏下载"); m_static.MoveWindow(10,40,80,80); m_listbox.MoveWindow(12,58,410,100); m_listbox.InitListCtrl(RGB(194,212,234),RGB(0,0,0),RGB(249,175,40),RGB(0,0,0),""); m_listbox.setProcessPos(2); m_listbox.SetProcessImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP6),MAKEINTRESOURCE(IDB_BITMAP7)); m_listbox.InsertColumn(0,"文件名",LVCFMT_CENTER,130); m_listbox.InsertColumn(1,"大小(KB)",LVCFMT_CENTER,60); m_listbox.InsertColumn(2,"进度",LVCFMT_CENTER,170); m_listbox.InsertColumn(3,"速度",LVCFMT_CENTER,50); m_listbox.InitListHeader(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1),MAKEINTRESOURCE(IDB_BITMAP1),RGB(255,255,255),RGB(255,255,255),1); m_listbox.SetTimer(100,10,NULL); m_exit.LoadImageFromeResource(AfxGetInstanceHandle(),IDB_BITMAP5); m_exit.SetPosition(CPoint(410,10)); m_cancel.LoadImageFromeResource(AfxGetInstanceHandle(),IDB_BITMAP4); m_cancel.SetPosition(CPoint(360,175)); //Validate the URL ASSERT(m_sURLToDownload.GetLength()); //Did you forget to specify the file to download if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort)) { //Try sticking "http://" before it m_sURLToDownload = CString("http://") + m_sURLToDownload; if (!AfxParseURL(m_sURLToDownload, m_dwServiceType, m_sServer, m_sObject, m_nPort)) { TRACE(_T("Failed to parse the URL: %s\n"), m_sURLToDownload); EndDialog(IDCANCEL); return TRUE; } } //Check to see if the file we are downloading to exists and if //it does, then ask the user if they were it overwritten CFileStatus fs; ASSERT(m_sFileToDownloadInto.GetLength()); if (CFile::GetStatus(m_sFileToDownloadInto, fs)) {/* CString sMsg; AfxFormatString1(sMsg, IDS_HTTPDOWNLOAD_OK_TO_OVERWRITE, m_sFileToDownloadInto); if (AfxMessageBox(sMsg, MB_YESNO) != IDYES) { TRACE(_T("Failed to confirm file overwrite, download aborted\n")); EndDialog(IDCANCEL); return TRUE; }*/ } //Try and open the file we will download into if (!m_FileToWrite.Open(m_sFileToDownloadInto, CFile::modeCreate | CFile::modeWrite | CFile::shareDenyWrite)) { TRACE(_T("Failed to open the file to download into, Error:%d\n"), GetLastError()); CString sError; sError.Format(_T("%d"), ::GetLastError()); CString sMsg; AfxFormatString1(sMsg, IDS_HTTPDOWNLOAD_FAIL_FILE_OPEN, sError); //AFCMessageBox(sMsg); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,sMsg); EndDialog(IDCANCEL); return TRUE; } //Pull out just the filename component int nSlash = m_sObject.ReverseFind(_T('/')); if (nSlash == -1) nSlash = m_sObject.ReverseFind(_T('\\')); if (nSlash != -1 && m_sObject.GetLength() > 1) m_sFilename = m_sObject.Right(m_sObject.GetLength() - nSlash - 1); else m_sFilename = m_sObject; m_listbox.InsertItem(0,m_sFilename.GetBuffer()); //Set the file status text CString sFileStatus; ASSERT(m_sObject.GetLength()); ASSERT(m_sServer.GetLength()); AfxFormatString2(sFileStatus, IDS_HTTPDOWNLOAD_FILESTATUS, m_sFilename, m_sServer); m_ctrlFileStatus.SetWindowText(sFileStatus); //Spin off the background thread which will do the actual downloading m_pThread = AfxBeginThread(_DownloadThread, this, THREAD_PRIORITY_NORMAL, CREATE_SUSPENDED); if (m_pThread == NULL) { TRACE(_T("Failed to create download thread, dialog is aborting\n")); EndDialog(IDCANCEL); return TRUE; } m_pThread->m_bAutoDelete = FALSE; m_pThread->ResumeThread(); return TRUE; }
LRESULT CLogProcessNameFilterEditDlg::OnInitDialog(HWND /*hwndFocus*/, LPARAM /*lp*/) { SetDlgItemText(IDC_EDIT_LOG_PROCESSNAME, m_filter->m_process_name.c_str()); CenterWindow(); return 0; }
BOOL CGitProgressDlg::OnInitDialog() { __super::OnInitDialog(); // Let the TaskbarButtonCreated message through the UIPI filter. If we don't // do this, Explorer would be unable to send that message to our window if we // were running elevated. It's OK to make the call all the time, since if we're // not elevated, this is a no-op. CHANGEFILTERSTRUCT cfs = { sizeof(CHANGEFILTERSTRUCT) }; typedef BOOL STDAPICALLTYPE ChangeWindowMessageFilterExDFN(HWND hWnd, UINT message, DWORD action, PCHANGEFILTERSTRUCT pChangeFilterStruct); CAutoLibrary hUser = AtlLoadSystemLibraryUsingFullPath(_T("user32.dll")); if (hUser) { ChangeWindowMessageFilterExDFN *pfnChangeWindowMessageFilterEx = (ChangeWindowMessageFilterExDFN*)GetProcAddress(hUser, "ChangeWindowMessageFilterEx"); if (pfnChangeWindowMessageFilterEx) { pfnChangeWindowMessageFilterEx(m_hWnd, WM_TASKBARBTNCREATED, MSGFLT_ALLOW, &cfs); } } m_ProgList.m_pTaskbarList.Release(); if (FAILED(m_ProgList.m_pTaskbarList.CoCreateInstance(CLSID_TaskbarList))) m_ProgList.m_pTaskbarList = nullptr; UpdateData(FALSE); AddAnchor(IDC_SVNPROGRESS, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_TITLE_ANIMATE, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_PROGRESSLABEL, BOTTOM_LEFT, BOTTOM_CENTER); AddAnchor(IDC_PROGRESSBAR, BOTTOM_CENTER, BOTTOM_RIGHT); AddAnchor(IDC_INFOTEXT, BOTTOM_LEFT, BOTTOM_RIGHT); AddAnchor(IDCANCEL, BOTTOM_RIGHT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDC_LOGBUTTON, BOTTOM_RIGHT); //SetPromptParentWindow(this->m_hWnd); m_Animate.Open(IDR_DOWNLOAD); m_ProgList.m_pAnimate = &m_Animate; m_ProgList.m_pProgControl = &m_ProgCtrl; m_ProgList.m_pProgressLabelCtrl = &m_ProgLableCtrl; m_ProgList.m_pInfoCtrl = &m_InfoCtrl; m_ProgList.m_pPostWnd = this; m_ProgList.m_bSetTitle = true; if (hWndExplorer) CenterWindow(CWnd::FromHandle(hWndExplorer)); EnableSaveRestore(_T("GITProgressDlg")); m_background_brush.CreateSolidBrush(GetSysColor(COLOR_WINDOW)); m_ProgList.Init(); int autoClose = CRegDWORD(_T("Software\\TortoiseGit\\AutoCloseGitProgress"), 0); CCmdLineParser parser(AfxGetApp()->m_lpCmdLine); if (parser.HasKey(_T("closeonend"))) autoClose = parser.GetLongVal(_T("closeonend")); switch (autoClose) { case 1: m_AutoClose = AUTOCLOSE_IF_NO_OPTIONS; break; case 2: m_AutoClose = AUTOCLOSE_IF_NO_ERRORS; break; default: m_AutoClose = AUTOCLOSE_NO; break; } return TRUE; }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // center the dialog on the screen CenterWindow(); // set icons HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); SetIcon(hIcon, TRUE); HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); SetIcon(hIconSmall, FALSE); int nItem = 0; m_cboThread = GetDlgItem(IDC_THREAD); nItem = m_cboThread.AddString(_T("Main thread")); m_cboThread.SetItemData(nItem, 0); nItem = m_cboThread.AddString(_T("Worker thread")); m_cboThread.SetItemData(nItem, 1); m_cboThread.SetCurSel(0); m_cboExcType = GetDlgItem(IDC_EXCTYPE); nItem = m_cboExcType.AddString(_T("SEH exception")); m_cboExcType.SetItemData(nItem, CR_SEH_EXCEPTION); nItem = m_cboExcType.AddString(_T("terminate")); m_cboExcType.SetItemData(nItem, CR_CPP_TERMINATE_CALL); nItem = m_cboExcType.AddString(_T("unexpected")); m_cboExcType.SetItemData(nItem, CR_CPP_UNEXPECTED_CALL); nItem = m_cboExcType.AddString(_T("pure virtual method call")); m_cboExcType.SetItemData(nItem, CR_CPP_PURE_CALL); nItem = m_cboExcType.AddString(_T("new operator fault")); m_cboExcType.SetItemData(nItem, CR_CPP_NEW_OPERATOR_ERROR); nItem = m_cboExcType.AddString(_T("buffer overrun")); m_cboExcType.SetItemData(nItem, CR_CPP_SECURITY_ERROR); nItem = m_cboExcType.AddString(_T("invalid parameter")); m_cboExcType.SetItemData(nItem, CR_CPP_INVALID_PARAMETER); nItem = m_cboExcType.AddString(_T("SIGABRT")); m_cboExcType.SetItemData(nItem, CR_CPP_SIGABRT); nItem = m_cboExcType.AddString(_T("SIGFPE")); m_cboExcType.SetItemData(nItem, CR_CPP_SIGFPE); nItem = m_cboExcType.AddString(_T("SIGILL")); m_cboExcType.SetItemData(nItem, CR_CPP_SIGILL); nItem = m_cboExcType.AddString(_T("SIGINT")); m_cboExcType.SetItemData(nItem, CR_CPP_SIGINT); nItem = m_cboExcType.AddString(_T("SIGSEGV")); m_cboExcType.SetItemData(nItem, CR_CPP_SIGSEGV); nItem = m_cboExcType.AddString(_T("SIGTERM")); m_cboExcType.SetItemData(nItem, CR_CPP_SIGTERM); nItem = m_cboExcType.AddString(_T("throw C++ typed exception")); m_cboExcType.SetItemData(nItem, CR_THROW); nItem = m_cboExcType.AddString(_T("Manual report")); m_cboExcType.SetItemData(nItem, MANUAL_REPORT); m_cboExcType.SetCurSel(0); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); if(m_bRestarted) { PostMessage(WM_POSTCREATE); } return TRUE; }
BOOL CTreePropSheet::OnInitDialog() { if (m_bTreeViewMode) { // be sure, there are no stacked tabs, because otherwise the // page caption will be to large in tree view mode EnableStackedTabs(FALSE); // Initialize image list. if (m_DefaultImages.GetSafeHandle()) { IMAGEINFO ii; m_DefaultImages.GetImageInfo(0, &ii); if (ii.hbmImage) DeleteObject(ii.hbmImage); if (ii.hbmMask) DeleteObject(ii.hbmMask); m_Images.Create(ii.rcImage.right-ii.rcImage.left, ii.rcImage.bottom-ii.rcImage.top, ILC_COLOR32|ILC_MASK, 0, 1); } else m_Images.Create(16, 16, ILC_COLOR32|ILC_MASK, 0, 1); } // perform default implementation BOOL bResult = CPropertySheet::OnInitDialog(); HighColorTab::UpdateImageList(*this); if (!m_bTreeViewMode) // stop here, if we would like to use tabs return bResult; // Get tab control... CTabCtrl *pTab = GetTabControl(); if (!IsWindow(pTab->GetSafeHwnd())) { ASSERT(FALSE); return bResult; } // ... and hide it pTab->ShowWindow(SW_HIDE); pTab->EnableWindow(FALSE); // Place another (empty) tab ctrl, to get a frame instead CRect rectFrame; pTab->GetWindowRect(rectFrame); ScreenToClient(rectFrame); m_pFrame = CreatePageFrame(); if (!m_pFrame) { ASSERT(FALSE); AfxThrowMemoryException(); } m_pFrame->Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF); m_pFrame->ShowCaption(m_bPageCaption); // Lets make place for the tree ctrl const int nTreeWidth = m_nPageTreeWidth; const int nTreeSpace = 5; CRect rectSheet; GetWindowRect(rectSheet); rectSheet.right+= nTreeWidth; SetWindowPos(NULL, -1, -1, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER|SWP_NOMOVE); CenterWindow(); MoveChildWindows(nTreeWidth, 0); // Lets calculate the rectangle for the tree ctrl CRect rectTree(rectFrame); rectTree.right = rectTree.left + nTreeWidth - nTreeSpace; // calculate caption height CTabCtrl wndTabCtrl; wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234); wndTabCtrl.InsertItem(0, _T("")); CRect rectFrameCaption; wndTabCtrl.GetItemRect(0, rectFrameCaption); wndTabCtrl.DestroyWindow(); m_pFrame->SetCaptionHeight(rectFrameCaption.Height()); // if no caption should be displayed, make the window smaller in // height if (!m_bPageCaption) { // make frame smaller m_pFrame->GetWnd()->GetWindowRect(rectFrame); ScreenToClient(rectFrame); rectFrame.top+= rectFrameCaption.Height(); m_pFrame->GetWnd()->MoveWindow(rectFrame); // move all child windows up MoveChildWindows(0, -rectFrameCaption.Height()); // modify rectangle for the tree ctrl rectTree.bottom-= rectFrameCaption.Height(); // make us smaller CRect rect; GetWindowRect(rect); rect.top+= rectFrameCaption.Height()/2; rect.bottom-= rectFrameCaption.Height()-rectFrameCaption.Height()/2; if (GetParent()) GetParent()->ScreenToClient(rect); MoveWindow(rect); } // finally create the tree control const DWORD dwTreeStyle = TVS_SHOWSELALWAYS|TVS_TRACKSELECT|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS; m_pwndPageTree = CreatePageTreeObject(); if (!m_pwndPageTree) { ASSERT(FALSE); AfxThrowMemoryException(); } // MFC7-support here (Thanks to Rainer Wollgarten) // YT: Cast tree control to CWnd and calls CWnd::CreateEx in all cases (VC 6 and7). ((CWnd*)m_pwndPageTree)->CreateEx( WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY|TVS_EX_DOUBLEBUFFER, _T("SysTreeView32"), _T("PageTree"), WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle, rectTree, this, s_unPageTreeId); if (m_bTreeImages) { m_pwndPageTree->SetImageList(&m_Images, TVSIL_NORMAL); m_pwndPageTree->SetImageList(&m_Images, TVSIL_STATE); } SetWindowTheme(m_pwndPageTree->GetSafeHwnd(), L"Explorer", NULL); // Fill the tree ctrl RefillPageTree(); // Select item for the current page if (pTab->GetCurSel() > -1) SelectPageTreeItem(pTab->GetCurSel()); return bResult; }
LRESULT CColorSetupDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CenterWindow(); COLORREF BrushColor; // Windows colors m_WindowsText.SubclassWindow(GetDlgItem(IDC_BUTTON_WINDOWS_TEXT_COLOR)); m_WindowsText.SetDefaultText(IDS_COLOR_DEFAULT); m_WindowsText.SetDefaultColor(m_clDefTextColor); m_WindowsText.SetColor((m_clWindowsText != CLR_NONE)? m_clWindowsText : CLR_DEFAULT); m_WindowsBack.SubclassWindow(GetDlgItem(IDC_BUTTON_WINDOWS_BACK_COLOR)); m_WindowsBack.SetDefaultText(IDS_COLOR_DEFAULT); m_WindowsBack.SetDefaultColor(m_clDefBackColor); m_WindowsBack.SetColor(BrushColor = ((m_clWindowsBack != CLR_NONE) ? m_clWindowsBack : CLR_DEFAULT)); if (BrushColor == CLR_DEFAULT) { BrushColor = m_clDefBackColor; } m_WindowsBrush.CreateSolidBrush(BrushColor); //Command Colors m_CommandText.SubclassWindow(GetDlgItem(IDC_BUTTON_COMMAND_TEXT_COLOR)); m_CommandText.SetDefaultText(IDS_COLOR_DEFAULT); m_CommandText.SetDefaultColor(m_clDefTextColor); m_CommandText.SetColor((m_clCommandText != CLR_NONE) ? m_clCommandText : CLR_DEFAULT); m_CommandBack.SubclassWindow(GetDlgItem(IDC_BUTTON_COMMAND_BACK_COLOR)); m_CommandBack.SetDefaultText(IDS_COLOR_DEFAULT); m_CommandBack.SetDefaultColor(m_clDefBackColor); m_CommandBack.SetColor(BrushColor = ((m_clCommandBack != CLR_NONE) ? m_clCommandBack : CLR_DEFAULT)); if (BrushColor == CLR_DEFAULT) { BrushColor = m_clDefBackColor; } m_CommandBrush.CreateSolidBrush(BrushColor); //Notify Colors m_NotifyText.SubclassWindow(GetDlgItem(IDC_BUTTON_NOTIFY_TEXT_COLOR)); m_NotifyText.SetDefaultText(IDS_COLOR_DEFAULT); m_NotifyText.SetDefaultColor(m_clDefTextColor); m_NotifyText.SetColor((m_clNotifyText != CLR_NONE) ? m_clNotifyText : CLR_DEFAULT); m_NotifyBack.SubclassWindow(GetDlgItem(IDC_BUTTON_NOTIFY_BACK_COLOR)); m_NotifyBack.SetDefaultText(IDS_COLOR_DEFAULT); m_NotifyBack.SetDefaultColor(m_clDefBackColor); m_NotifyBack.SetColor(BrushColor = ((m_clNotifyBack != CLR_NONE) ? m_clNotifyBack : CLR_DEFAULT)); if (BrushColor == CLR_DEFAULT) { BrushColor = m_clDefBackColor; } m_NotifyBrush.CreateSolidBrush(BrushColor); //Reflect Colors m_ReflectText.SubclassWindow(GetDlgItem(IDC_BUTTON_REFLECT_TEXT_COLOR)); m_ReflectText.SetDefaultText(IDS_COLOR_DEFAULT); m_ReflectText.SetDefaultColor(m_clDefTextColor); m_ReflectText.SetColor((m_clReflectText != CLR_NONE) ? m_clReflectText : CLR_DEFAULT); m_ReflectBack.SubclassWindow(GetDlgItem(IDC_BUTTON_REFLECT_BACK_COLOR)); m_ReflectBack.SetDefaultText(IDS_COLOR_DEFAULT); m_ReflectBack.SetDefaultColor(m_clDefBackColor); m_ReflectBack.SetColor(BrushColor = ((m_clReflectBack != CLR_NONE) ? m_clReflectBack : CLR_DEFAULT)); if (BrushColor == CLR_DEFAULT) { BrushColor = m_clDefBackColor; } m_ReflectBrush.CreateSolidBrush(BrushColor); return 1; // Let the system set the focus }
LRESULT CALLBACK CFG_MainProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { g_tvIndexCFG = 0; g_hwndTree = GetDlgItem(hDlg,IDC_TREE_CONF); SendMessage(g_hwndTree, TVM_SETIMAGELIST , TVSIL_NORMAL, (LPARAM)g_hImageListIcons); SendMessage(g_hwndTree, TVM_SETIMAGELIST , TVSIL_STATE, (LPARAM)g_hImageListStates); HTREEITEM hNewItem; hNewItem = TreeView_AddItem(27,g_lang.GetString("ConfigGeneral")); hNewItem = TreeView_AddItem(15,g_lang.GetString("ConfigMinimizer")); hNewItem = TreeView_AddItem(28,"mIRC"); hNewItem = TreeView_AddItem(3,"Account (XMPP)"); hNewItem = TreeView_AddItem(16,g_lang.GetString("ConfigExtExe")); hNewItem = TreeView_AddItem(25,g_lang.GetString("ConfigGraphic")); hNewItem = TreeView_AddItem(13,g_lang.GetString("ConfigNetwork")); hNewItem = TreeView_AddItem(20 ,g_lang.GetString("ConfigGames")); if (hNewItem) TreeView_Select(g_hwndTree, hNewItem, TVGN_CARET); for(UINT i=0;i<gm.GamesInfo.size();i++) hNewItem = TreeView_AddItem(gm.GamesInfo[i].iIconIndex,gm.GamesInfo[i].szGAME_SHORTNAME); TreeView_Select(g_hwndTree, NULL, TVGN_CARET); for(UINT i=0; i<gm.GamesInfo.size();i++) { GamesInfoCFG[i].bActive = gm.GamesInfo[i].bActive; GamesInfoCFG[i].bUseHTTPServerList[0] = gm.GamesInfo[i].bUseHTTPServerList[0]; GamesInfoCFG[i].dwMasterServerPORT = gm.GamesInfo[i].dwMasterServerPORT; strcpy(GamesInfoCFG[i].szGAME_NAME, gm.GamesInfo[i].szGAME_NAME); strcpy(GamesInfoCFG[i].szMasterServerIP[0], gm.GamesInfo[i].szMasterServerIP[0]); GamesInfoCFG[i].vGAME_INST = gm.GamesInfo[i].vGAME_INST; } memcpy(&AppCFGtemp,&AppCFG,sizeof(APP_SETTINGS_NEW)); CFG_g_sMIRCoutputTemp = g_sMIRCoutput; SetDlgItemText(hDlg,IDOK,g_lang.GetString("Ok")); SetDlgItemText(hDlg,IDC_BUTTON_DEFAULT,g_lang.GetString("SetDefault")); SetDlgItemText(hDlg,IDCANCEL,g_lang.GetString("Cancel")); CenterWindow(hDlg); CFG_OnTabbedDialogInit(hDlg) ; return TRUE; } case WM_NOTIFY: { NMTREEVIEW *lpnmtv; lpnmtv = (LPNMTREEVIEW)lParam; switch (wParam) { case IDC_TREE_CONF: { NMTREEVIEW *pnmtv; pnmtv = (LPNMTREEVIEW) lParam; if((lpnmtv->hdr.code == TVN_SELCHANGED) ) { if((g_bChanged==true) && (pnmtv->action == TVC_BYMOUSE)) CFG_ApplySettings(); CFG_OnSelChanged(hDlg); } } break; } break; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDCANCEL: LocalFree(g_pHdr); EndDialog(hDlg, LOWORD(wParam)); return TRUE; case IDOK: { CFG_ApplySettings(); if(AppCFGtemp.bAutostart) AddAutoRun(EXE_PATH); else RemoveAutoRun(); if(AppCFGtemp.bUse_minimize) { UnregisterHotKey(NULL, HOTKEY_ID); if (!RegisterHotKey(NULL, HOTKEY_ID, AppCFGtemp.dwMinimizeMODKey ,AppCFGtemp.cMinimizeKey)) { //probably already registred MessageBox(NULL,g_lang.GetString("ErrorRegHotkey"),"Hotkey error",NULL); } }else { UnregisterHotKey(NULL, HOTKEY_ID); } for(UINT i=0; i<gm.GamesInfo.size();i++) { gm.GamesInfo[i].bActive = GamesInfoCFG[i].bActive; gm.GamesInfo[i].bUseHTTPServerList[0] = GamesInfoCFG[i].bUseHTTPServerList[0]; gm.GamesInfo[i].dwMasterServerPORT = GamesInfoCFG[i].dwMasterServerPORT; strcpy(gm.GamesInfo[i].szMasterServerIP[0], GamesInfoCFG[i].szMasterServerIP[0]); gm.GamesInfo[i].vGAME_INST = GamesInfoCFG[i].vGAME_INST; } memcpy(&AppCFG,&AppCFGtemp,sizeof(APP_SETTINGS_NEW)); //memcpy(&GI,&GamesInfoCFG,sizeof(GAME_INFO)*GamesInfo.size()); // ZeroMemory(&GamesInfoCFG,sizeof(GAME_INFO)*GamesInfo.size()); ZeroMemory(&AppCFGtemp,sizeof(APP_SETTINGS_NEW)); HANDLE hThread=NULL; DWORD dwThreadIdBrowser=0; hThread = CreateThread( NULL, 0, &CFG_Save,(LPVOID)0 ,0, &dwThreadIdBrowser); if (hThread == NULL) { g_log.AddLogInfo(GS_LOG_WARNING, "CreateThread CFG_Save failed (%d)\n", GetLastError() ); } else { CloseHandle( hThread ); } // CFG_Save(0); LocalFree(g_pHdr); EndDialog(hDlg, LOWORD(wParam)); return TRUE; } case IDC_BUTTON_DEFAULT: { Default_Appsettings(); // Default_GameSettings(); memcpy(&AppCFGtemp,&AppCFG,sizeof(APP_SETTINGS_NEW)); //memcpy(&GamesInfoCFG,&GI,sizeof(GAME_INFO)*GamesInfo.size()); //GamesInfoCFG = GamesInfo; g_currSelCfg=-1; CFG_OnSelChanged(hDlg); return TRUE; } break; } } } return FALSE; }
BOOL CALLBACK SendMailDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { static HWND hEdit, hSubject, hRecipients; static MailInfo *reply; MINMAXINFO *lpmmi; switch (message) { case WM_INITDIALOG: CenterWindow(hDlg, cinfo->hMain); hEdit = GetDlgItem(hDlg, IDC_MAILEDIT); hSubject = GetDlgItem(hDlg, IDC_SUBJECT); hRecipients = GetDlgItem(hDlg, IDC_RECIPIENTS); /* Store dialog rectangle in case of resize */ GetWindowRect(hDlg, &dlg_rect); Edit_LimitText(hEdit, MAXMAIL - 1); Edit_LimitText(hSubject, MAX_SUBJECT - 1); Edit_LimitText(hRecipients, (MAXUSERNAME + 2) * MAX_RECIPIENTS - 1); SendMessage(hDlg, BK_SETDLGFONTS, 0, 0); EnableWindow(GetDlgItem(hDlg, IDOK), FALSE); hSendMailDlg = hDlg; // See if we should initialize dialog for a reply reply = (MailInfo *) lParam; if (reply != NULL) { SendMailInitialize(hDlg, reply); SetFocus(hEdit); } return 0; case WM_SIZE: ResizeDialog(hDlg, &dlg_rect, mailsend_controls); return TRUE; case WM_GETMINMAXINFO: lpmmi = (MINMAXINFO *) lParam; lpmmi->ptMinTrackSize.x = 250; lpmmi->ptMinTrackSize.y = 200; return 0; case WM_ACTIVATE: if (wParam == 0) *cinfo->hCurrentDlg = NULL; else *cinfo->hCurrentDlg = hDlg; return TRUE; case BK_SETDLGFONTS: SetWindowFont(hEdit, GetFont(FONT_MAIL), TRUE); SetWindowFont(hSubject, GetFont(FONT_MAIL), TRUE); SetWindowFont(hRecipients, GetFont(FONT_MAIL), TRUE); return TRUE; case BK_SETDLGCOLORS: InvalidateRect(hDlg, NULL, TRUE); return TRUE; HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, MailCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, MailCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, MailCtlColor); HANDLE_MSG(hDlg, WM_CTLCOLORDLG, MailCtlColor); HANDLE_MSG(hDlg, WM_INITMENUPOPUP, InitMenuPopupHandler); case WM_CLOSE: SendMessage(hDlg, WM_COMMAND, IDCANCEL, 0); break; case WM_DESTROY: hSendMailDlg = NULL; if (exiting) PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID); break; case WM_COMMAND: UserDidSomething(); switch(GET_WM_COMMAND_ID(wParam, lParam)) { case IDCANCEL: DestroyWindow(hDlg); return TRUE; case IDOK: /* User has pressed return somewhere */ if (GetFocus() == hSubject) SetFocus(hEdit); else if (GetFocus() == hRecipients) SetFocus(hSubject); return TRUE; case IDC_OK: SendMailMessage(hDlg); return TRUE; } break; } return FALSE; }
bool CDialogRange::getValue(CWnd* pParent, double& fLower, double& fUpper) { int l = 0; int t = 0; int w = 300; int h = 140; int ch = 21; // control's height int bw = 80; // button width CString s = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, LoadCursor(NULL, IDC_ARROW), CBrush(::GetSysColor(COLOR_BTNFACE))); if (!CreateEx(WS_EX_DLGMODALFRAME, s, "Set Graph's Upper && Lower limit", WS_SYSMENU | WS_POPUP | WS_BORDER | WS_CAPTION, l, t, w, h, pParent->GetSafeHwnd(), NULL)) return 0; CenterWindow(); DWORD dwStaticStyles = WS_VISIBLE | WS_CHILD | SS_NOPREFIX | SS_RIGHT; DWORD dwEditStyles = WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL; DWORD dwButtonStyles = WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON; l = 6; t = 6; if (!m_cLowerLegend.Create("Lower Limit", dwStaticStyles, CRect(l,t,l+100,t+ch), this)) return false; l += 120; s.Format("%.2f", fLower); if (!m_cLower.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), s, dwEditStyles, CRect(l,t,l+100,t+ch), this, 1)) return false; l = 6; t += ch + 10; if (!m_cUpperLegend.Create("Upper Limit", dwStaticStyles, CRect(l,t,l+100,t+ch), this)) return false; l += 120; s.Format("%.2f", fUpper); if (!m_cUpper.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), s, dwEditStyles, CRect(l,t,l+100,t+ch), this, 2)) return false; l = w / 2 - (bw + 5); t += ch + 10; if (!m_cOk.Create(_T("OK"), dwButtonStyles, CRect(l, t, l+bw, t+ch), this, IDOK)) return false; l = w / 2 + 5; if (!m_cCancel.Create(_T("Cancel"), dwButtonStyles, CRect(l, t, l+bw, t+ch), this, IDCANCEL)) return false; CFont m_Font; m_Font.CreatePointFont(80, "MS Sans Serif"); m_cLowerLegend.SetFont(&m_Font, false); m_cUpperLegend.SetFont(&m_Font, false); m_cLower.SetFont(&m_Font, false); m_cUpper.SetFont(&m_Font, false); m_cOk.SetFont(&m_Font, false); m_cCancel.SetFont(&m_Font, false); ShowWindow(SW_SHOW); pParent->EnableWindow(false); EnableWindow(true); // enter modal loop DWORD dwFlags = MLF_SHOWONIDLE; if (GetStyle() & DS_NOIDLEMSG) dwFlags |= MLF_NOIDLEMSG; m_cLower.SetFocus(); int nRet = RunModalLoop(MLF_NOIDLEMSG); if (nRet == IDOK) { m_cLower.GetWindowText(s); fLower = atof(s); m_cUpper.GetWindowText(s); fUpper = atof(s); } if (m_hWnd != NULL) SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); pParent->SetFocus(); if (GetParent() != NULL && ::GetActiveWindow() == m_hWnd) ::SetActiveWindow(pParent->m_hWnd); if (::IsWindow(m_hWnd)) DestroyWindow(); pParent->EnableWindow(true); return true; }
virtual void SetupWindow() { TDialog::SetupWindow(); CenterWindow(this); }
long APIENTRY FileChangeProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: if (!CreateFileSaveData(hwnd, TRUE)) EndDialog(hwnd, 1); else CenterWindow(hwnd); return 1; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == NM_CUSTOMDRAW) { SetWindowLong(hwnd, DWL_MSGRESULT, CustomDraw(hwnd, (LPNMLVCUSTOMDRAW)lParam)); return TRUE; } else if (((LPNMHDR)lParam)->code == LVN_KEYDOWN) { switch (((LPNMLVKEYDOWN)lParam)->wVKey) { case VK_INSERT: if (GetKeyState(VK_CONTROL) & 0x80000000) { HWND hwndLV = GetDlgItem(hwnd, IDC_FILELIST); ListView_SetCheckState(hwndLV, -1, TRUE); SetOKText(hwnd, "Reload"); } else { HWND hwndLV = GetDlgItem(hwnd, IDC_FILELIST); int i = ListView_GetSelectionMark(hwndLV); ListView_SetCheckState(hwndLV, i, TRUE); } break; case VK_DELETE: if (GetKeyState(VK_CONTROL) & 0x80000000) { HWND hwndLV = GetDlgItem(hwnd, IDC_FILELIST); ListView_SetCheckState(hwndLV, -1, FALSE); SetOKText(hwnd, "Reload"); } else { HWND hwndLV = GetDlgItem(hwnd, IDC_FILELIST); int i = ListView_GetSelectionMark(hwndLV); ListView_SetCheckState(hwndLV, i, FALSE); } break; } } if (wParam == IDC_FILELIST) { if (((LPNMHDR)lParam)->code == LVN_GETDISPINFO) { LV_DISPINFO *plvdi = (LV_DISPINFO*)lParam; struct saveData *sd; plvdi->item.mask |= LVIF_TEXT | LVIF_DI_SETITEM; plvdi->item.mask &= ~LVIF_STATE; switch (plvdi->item.iSubItem) { case 2: sd = (struct saveData *)plvdi->item.lParam; if (sd->asProject) { PROJECTITEM *pj = sd->data; plvdi->item.pszText = pj->displayName; } else { DWINFO *ptr = sd->data; plvdi->item.pszText = ptr->dwTitle; } break; } } else if (((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) { SetOKText(hwnd, "Reload"); } } break; case WM_COMMAND: switch (wParam &0xffff) { case IDOK: ParseFileSaveData(hwnd, TRUE); EndDialog(hwnd, IDOK); break; case IDCANCEL: EndDialog(hwnd, IDCANCEL); break; case IDC_SELECTALL: { HWND hwndLV = GetDlgItem(hwnd, IDC_FILELIST); ListView_SetCheckState(hwndLV, -1, TRUE); SetOKText(hwnd, "Reload"); } break; case IDC_DESELECTALL: { HWND hwndLV = GetDlgItem(hwnd, IDC_FILELIST); ListView_SetCheckState(hwndLV, -1, FALSE); SetOKText(hwnd, "Reload"); } break; case IDHELP: ContextHelp(IDH_RELOAD_FILE_DIALOG); break; } break; case WM_CLOSE: PostMessage(hwnd, WM_COMMAND, IDCANCEL, 0); break; } return 0; }
BOOL CSICommitDlg::OnInitDialog() { // Call the super class OnInitDialog() CResizableStandAloneDialog::OnInitDialog(); // Make the dialog unpinnable CAppUtils::MarkWindowAsUnpinnable(m_hWnd); // Load keyboard accelerator resource m_hAccelerator = LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_ACC_SICOMMITDLG)); // Initialize control data in dialog box UpdateData(FALSE); m_tooltips.Create(this); //TODO: Add resource strings for tool tips //TODO: Register tool tips against controls //m_tooltips.AddTool(IDC_EXTERNALWARNING, IDS_COMMITDLG_EXTERNALS); //TODO: Set any dynamic control text, e.g. dynamic labels //SetDlgItemText(ID_RESOURCEID, _T("")); m_ctrlChangePackageComboBox.SetFocus(); GetWindowText(m_sWindowTitle); // TODO: Adjust the size of radio buttoms and check boxes to fit translated text //AdjustControlSize(IDC_SHOWUNVERSIONED); // line up all controls and adjust their sizes. //#define LINKSPACING 9 //RECT rc = AdjustControlSize(IDC_SELECTLABEL); //rc.right -= 15; // AdjustControlSize() adds 20 pixels for the checkbox/radio button bitmap, but this is a label... //rc = AdjustStaticSize(IDC_CHECKALL, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKNONE, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKUNVERSIONED, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKVERSIONED, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKADDED, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKDELETED, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKMODIFIED, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKFILES, rc, LINKSPACING); //rc = AdjustStaticSize(IDC_CHECKSUBMODULES, rc, LINKSPACING); // Anchor controls using resizeable lib AddAnchor(IDC_SUBMIT_TO_CP_LABEL, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_SUBMIT_CP_COMBOBOX, TOP_RIGHT); AddAnchor(IDC_CREATE_CP_BUTTON, TOP_RIGHT); AddAnchor(IDC_SUBMIT_CP_BUTTON, BOTTOM_RIGHT); AddAnchor(IDCANCEL, BOTTOM_RIGHT); // Set restrictions on the width and height of the dialog //GetClientRect(m_DlgOrigRect); //SetMinTrackSize( CSize( mDlgOriginRect.Width(), m_DlgOriginRect.Height()) ); // Center dialog in Windows explorer (if its window handle was pass as parameter) if (theApp.m_hWndExplorer) { CenterWindow(CWnd::FromHandle(theApp.m_hWndExplorer)); } if (!theApp.m_serverConnectionsCache->isOnline()) { EventLog::writeInformation(L"SICommitDlg create cp bailing out, unable to connect to integrity server"); return FALSE; } UpdateChangePackageList(); // If there are no active change packages then disable submit cp button if( m_ctrlChangePackageComboBox.GetCount() == 0 ) { GetDlgItem(IDC_SUBMIT_CP_BUTTON)->EnableWindow(FALSE); } else { GetDlgItem(IDC_SUBMIT_CP_BUTTON)->EnableWindow(TRUE); m_ctrlChangePackageComboBox.SetCurSel(m_ctrlChangePackageComboBox.GetCount() - 1); } // Loads window rect that was saved allowing user to resize and persist EnableSaveRestore(_T("SICommitDlg")); // return TRUE unless you set the focus to a control return FALSE; }
/* void SetPaneWidths(int* arrWidths, int nPanes) { // find the size of the borders int arrBorders[3]; m_status.GetBorders(arrBorders); // calculate right edge of default pane (0) arrWidths[0] += arrBorders[2]; for (int i = 1; i < nPanes; i++) arrWidths[0] += arrWidths[i]; // calculate right edge of remaining panes (1 thru nPanes-1) for (int j = 1; j < nPanes; j++) arrWidths[j] += arrBorders[2] + arrWidths[j - 1]; // set the pane widths m_status.SetParts(m_status.m_nPanes, arrWidths); } */ LRESULT CMainFrame::OnCreate(LPCREATESTRUCT /*lParam*/) { // // create command bar window // HWND hWndCmdBar = m_CmdBar.Create( m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.SetImageSize(CSize(9,9)); // m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); // set title WTL::CString strTitle; strTitle.LoadString( IDS_APPLICATION ); SetWindowText(strTitle); // // setting up a tool bar // HWND hWndToolBar = CreateSimpleToolBarCtrl( m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST); m_wndToolBar.Attach( hWndToolBar ); m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS ); // // patria: // // Some bitmaps are distorted when used with TB_ADDBITMAP // which is sent from CreateSimpleToolBarCtrl when the bitmap is not true color. // This is the case with IO-DATA's tool bar image. // As an workaround, we can directly create a image list directly // and replace the image list of the tool bar, which corrects such misbehaviors. // { CImageList imageList; WORD wWidth = 32; // we are using 32 x 32 buttons imageList.CreateFromImage( IDR_MAINFRAME, wWidth, 1, CLR_DEFAULT, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); m_wndToolBar.SetImageList(imageList); } TBBUTTON tbButton = { 0 }; TBBUTTONINFO tbButtonInfo = { 0 }; TBREPLACEBITMAP replaceBitmap = { 0 }; // Add strings to the tool bar m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON)); for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ ) { WTL::CString strCommand; m_wndToolBar.GetButton( i, &tbButton ); tbButtonInfo.cbSize = sizeof(TBBUTTONINFO); tbButtonInfo.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo ); tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE; strCommand.LoadString( tbButton.idCommand ); strCommand = strCommand.Right( strCommand.GetLength() - strCommand.Find('\n') - 1 ); tbButtonInfo.pszText = const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand)); tbButtonInfo.cchText = strCommand.GetLength(); tbButtonInfo.fsStyle |= BTNS_SHOWTEXT | BTNS_AUTOSIZE; m_wndToolBar.AddString( tbButton.idCommand ); m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo ); } // // Modify mirror button as drop down button // { TBBUTTON tb; m_wndToolBar.GetButton( m_wndToolBar.CommandToIndex(IDM_AGGR_MIRROR), &tb); TBBUTTONINFO tbi = {0}; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo(IDM_AGGR_MIRROR, &tbi); tbi.fsStyle |= TBSTYLE_DROPDOWN; m_wndToolBar.SetButtonInfo( IDM_AGGR_MIRROR, &tbi); } #define ATL_CUSTOM_REBAR_STYLE \ ((ATL_SIMPLE_REBAR_STYLE & ~RBS_AUTOSIZE) | CCS_NODIVIDER) // // patria: reason to use ATL_CUSTOM_REBAR_STYLE // // ATL_SIMPLE_REBAR_STYLE (not a NO_BRODER style) has a problem // with theme-enabled Windows XP, // rendering some transparent lines above the rebar. // CreateSimpleReBar(ATL_CUSTOM_REBAR_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(m_wndToolBar.m_hWnd, NULL, TRUE); CReBarCtrl reBar = m_hWndToolBar; DWORD cBands = reBar.GetBandCount(); for (DWORD i = 0; i < cBands; ++i) { REBARBANDINFO rbi = {0}; rbi.cbSize = sizeof(REBARBANDINFO); rbi.fMask = RBBIM_STYLE; reBar.GetBandInfo(i, &rbi); rbi.fStyle |= RBBS_NOGRIPPER; reBar.SetBandInfo(i, &rbi); } // work on status bar, progress bar CreateSimpleStatusBar(); // m_wndStatusBar.SubclassWindow(m_hWndStatusBar); RECT rectRefreshProgress; /* #define ID_PANE_REFRESH_STATUS 1 int anPanes[] = {ID_DEFAULT_PANE, ID_PANE_REFRESH_STATUS}; m_wndStatusBar.SetPanes(anPanes, sizeof(anPanes) / sizeof(int), false); int anWidths[] = {400, -1}; m_wndStatusBar.SetParts(sizeof(anWidths) / sizeof(int), anWidths); m_wndStatusBar.GetPaneRect(ID_DEFAULT_PANE, &rectRefreshProgress); m_wndStatusBar.GetPaneRect(ID_PANE_REFRESH_STATUS, &rectRefreshProgress); */ // m_wndStatusBar.GetWindowRect(&rectRefreshProgress); ::GetClientRect(m_hWndStatusBar, &rectRefreshProgress); rectRefreshProgress.right = 300; m_wndRefreshProgress.Create(m_hWndStatusBar, &rectRefreshProgress, NULL, WS_CHILD | WS_VISIBLE); m_wndRefreshProgress.SetRange32(0, 100); m_wndRefreshProgress.SetPos(50); m_wndRefreshProgress.ShowWindow(SW_HIDE); /* m_wndStatusBar.SetPaneText(ID_DEFAULT_PANE, _T("text1")); m_wndStatusBar.SetPaneText(ID_PANE_REFRESH_STATUS, _T("text2")); */ m_wndHorzSplit.Create(*this, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_viewTree.Create( m_wndHorzSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASLINES | /* TVS_LINESATROOT | */ TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE ); m_viewList.Create( m_wndHorzSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_ICON | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE ); m_viewList.Initialize(); m_wndHorzSplit.SetSplitterPanes(m_viewList, m_viewTree); m_wndHorzSplit.m_cxyMin = 130; m_viewTreeList.Create( *this, rcDefault, NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_viewTreeList.Initialize(); // m_viewTreeList._Init(); // m_viewTreeList.SubclassWindow(m_hWnd); m_hWndClient = m_wndHorzSplit; m_hWndClient = m_viewTreeList; UIAddToolBar(m_wndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // TODO : It will be better if we display splash window while // the treeview is initialized m_bRefreshing = FALSE; ::InitializeCriticalSection(&m_csThreadRefreshStatus); // StartRefreshStatus(); // PostMessage(WM_COMMAND, IDM_AGGR_REFRESH, 0); m_hEventCallback = ::NdasRegisterEventCallback(pNdasEventProc,m_hWnd); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // FIXME : We need to remember the window size CRect rectResize; GetClientRect( rectResize ); rectResize = CRect( rectResize.TopLeft(), CSize(500, 500) ); ClientToScreen( rectResize ); MoveWindow( rectResize ); CenterWindow(); return 0; }
BOOL COpenFileDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_Left=0; m_Top=0; m_Width=480; n_list_i = 0; m_Height=272; bei = 0; n_ListPage = 1 ; ::SetWindowPos(this->GetSafeHwnd(),HWND_TOPMOST,m_Left, m_Top, m_Width, m_Height,SWP_SHOWWINDOW); // m_ListCtrl.SetExtendedStyle(LVS_EX_CHECKBOXES); m_BackScreenBitmap.LoadBitmap(IDB_OPEN_BKG); m_imagelist.Create(32,32,TRUE,2,2); SetToolRectangle(); m_imagelist.Add(AfxGetApp()->LoadIcon(IDI_MP3)); CenterWindow(GetDesktopWindow()); m_prePick=-1; m_currentPick=0; m_bIsExecute=FALSE ; m_ListCtrl.MoveWindow(40,55,344,165); BYTE m_Byte[16]={0x30,0x26,0xB2,0x75,0x8E,0x66,0xCF,0x11,0xA6,0xD9, 0x00 ,0xAA ,0x00 ,0x62 ,0xCE ,0x6C};//wma文件头。 char cBuffer[100]; memcpy(cBuffer,m_Byte,sizeof(m_Byte)); strWmaHead = cBuffer;//得到标准的WMA前字节字符串。 count = 0; bool bFinished = false; hSearch = FindFirstFile(strPath + L"mp3\\*.wma",&FileData); if (hSearch != INVALID_HANDLE_VALUE)//找到 while (!bFinished) { if(CheckWma(FileData.cFileName))//有效MP3文件,则向LIST中 添加文件 { m_ListCtrl.InsertItem(n_list_i,FileData.cFileName); } if (!FindNextFile(hSearch ,&FileData)) { bFinished = true; } } //查找wma bFinished = false; hSearch = FindFirstFile(strPath + L"mp3\\*.mp3",&FileData); if (hSearch != INVALID_HANDLE_VALUE) while (!bFinished) { if(CheckMp3(FileData.cFileName))//有效MP3文件,则向LIST中 添加文件 { m_ListCtrl.InsertItem(n_list_i,FileData.cFileName); } if (!FindNextFile(hSearch ,&FileData)) { bFinished = true; } } m_ListCtrl.SetImageList(&m_imagelist,LVSIL_NORMAL); m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); m_ListCtrl.SetBkColor(RGB(0,0,0)); m_ListCtrl.SetTextColor(RGB(255,255,255)); m_ListCtrl.SetTextBkColor(RGB(0,0,0)); // m_ListCtrl.SetIconSpacing(0,0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
LRESULT CDetailDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { DlgResize_Init(); CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { Utility::SetLayoutRTL(m_hWnd); } SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("DlgCaption"))); m_previewMode = PREVIEW_AUTO; m_filePreview.SubclassWindow(GetDlgItem(IDC_PREVIEW)); m_filePreview.SetBytesPerLine(10); m_filePreview.SetEmptyMessage(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("NoDataToDisplay"))); m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY)); m_linkPrivacyPolicy.SetHyperLink(g_CrashInfo.m_sPrivacyPolicyURL); m_linkPrivacyPolicy.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("PrivacyPolicy"))); if(!g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty()) m_linkPrivacyPolicy.ShowWindow(SW_SHOW); else m_linkPrivacyPolicy.ShowWindow(SW_HIDE); CStatic statHeader = GetDlgItem(IDC_HEADERTEXT); statHeader.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("DoubleClickAnItem"))); m_list = GetDlgItem(IDC_FILE_LIST); m_list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); m_list.InsertColumn(0, Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("FieldName")), LVCFMT_LEFT, 150); m_list.InsertColumn(1, Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("FieldDescription")), LVCFMT_LEFT, 180); m_list.InsertColumn(3, Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("FieldSize")), LVCFMT_RIGHT, 60); m_iconList.Create(16, 16, ILC_COLOR32|ILC_MASK, 3, 1); m_list.SetImageList(m_iconList, LVSIL_SMALL); // Insert items WIN32_FIND_DATA findFileData = {0}; HANDLE hFind = NULL; CString sSize; std::map<CString, ERIFileItem>::iterator p; unsigned i; for (i = 0, p = g_CrashInfo.GetReport(m_nCurReport).m_FileItems.begin(); p != g_CrashInfo.GetReport(m_nCurReport).m_FileItems.end(); p++, i++) { CString sDestFile = p->first; CString sSrcFile = p->second.m_sSrcFile; CString sFileDesc = p->second.m_sDesc; SHFILEINFO sfi; SHGetFileInfo(sSrcFile, 0, &sfi, sizeof(sfi), SHGFI_DISPLAYNAME | SHGFI_ICON | SHGFI_TYPENAME | SHGFI_SMALLICON); int iImage = -1; if(sfi.hIcon) { iImage = m_iconList.AddIcon(sfi.hIcon); DestroyIcon(sfi.hIcon); } int nItem = m_list.InsertItem(i, sDestFile, iImage); CString sFileType = sfi.szTypeName; m_list.SetItemText(nItem, 1, sFileDesc); hFind = FindFirstFile(sSrcFile, &findFileData); if (INVALID_HANDLE_VALUE != hFind) { FindClose(hFind); ULARGE_INTEGER lFileSize; lFileSize.LowPart = findFileData.nFileSizeLow; lFileSize.HighPart = findFileData.nFileSizeHigh; sSize = Utility::FileSizeToStr(lFileSize.QuadPart); m_list.SetItemText(nItem, 2, sSize); } } m_list.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); m_statPreview = GetDlgItem(IDC_PREVIEWTEXT); m_statPreview.SetWindowText(Utility::GetINIString( g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("Preview"))); m_btnClose = GetDlgItem(IDOK); m_btnClose.SetWindowText(Utility::GetINIString( g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("Close"))); m_btnExport = GetDlgItem(IDC_EXPORT); m_btnExport.SetWindowText(Utility::GetINIString( g_CrashInfo.m_sLangFileName, _T("DetailDlg"), _T("Export"))); // center the dialog on the screen CenterWindow(); return TRUE; }
BOOL CGameManageDlg::OnInitDialog() { CDialog::OnInitDialog(); //授权检测 long timeStamp=coreGetTimeStamp(); long licExpires=coreGetLicenseExpires(); if(timeStamp>licExpires) { CString s,code=coreGetCode(); s.Format("您的服务器未注册或已过期,请与服务商联系。\n\n请将以下机器码发送给服务商,获取注册码文件:\n\n%s\n\n",code); MessageBox(s,"提示",MB_ICONERROR); s="机器码已复制到您的剪贴板中,直接Ctrl+V粘贴机器码!"; MessageBox(s,"提示",MB_ICONINFORMATION); OpenClipboard(); EmptyClipboard(); HANDLE hData=GlobalAlloc(GMEM_MOVEABLE,code.GetLength()+5); if (hData==NULL) { CloseClipboard(); return TRUE; } LPTSTR szMemName=(LPTSTR)GlobalLock(hData); lstrcpy(szMemName,code); SetClipboardData(CF_TEXT,hData); GlobalUnlock(hData); GlobalFree(hData); CloseClipboard(); PostQuitMessage(0); DestroyWindow(); return FALSE; } // TODO: 在此添加额外的初始化 ModifyStyleEx(WS_EX_TOOLWINDOW, WS_EX_APPWINDOW); CenterWindow(); DWORD dwstyleEX = m_GameDiskListCtrl.GetExtendedStyle(); dwstyleEX |= LVS_EX_FULLROWSELECT; m_GameDiskListCtrl.SetExtendedStyle(dwstyleEX); dwstyleEX = m_GameUeserListCtrl.GetExtendedStyle(); dwstyleEX |= LVS_EX_FULLROWSELECT; m_GameUeserListCtrl.SetExtendedStyle(dwstyleEX); LONG lStyle; lStyle = GetWindowLong(m_GameDiskListCtrl.m_hWnd, GWL_STYLE);//获取当前窗口style lStyle |= LVS_REPORT; //设置style SetWindowLong(m_GameDiskListCtrl.m_hWnd, GWL_STYLE, lStyle);//设置styl lStyle; lStyle = GetWindowLong(m_GameUeserListCtrl.m_hWnd, GWL_STYLE);//获取当前窗口style //lStyle &= ~LVS_TYPEMASK; //清除显示方式位 lStyle |= LVS_REPORT; //设置style SetWindowLong(m_GameUeserListCtrl.m_hWnd, GWL_STYLE, lStyle);//设置styl m_GameUeserListCtrl.InsertColumn(0, "ID", LVCFMT_CENTER, 50); m_GameUeserListCtrl.InsertColumn(1, "昵称", LVCFMT_CENTER, 70); m_GameUeserListCtrl.InsertColumn(2, "状态", LVCFMT_CENTER, 70); m_GameUeserListCtrl.InsertColumn(3, "桌号", LVCFMT_CENTER, 70); m_GameDiskListCtrl.InsertColumn(0, "桌号ID", LVCFMT_CENTER, 100); m_GameDiskListCtrl.InsertColumn(1, "人数情况", LVCFMT_CENTER, 127); m_GameDiskListCtrl.InsertColumn(1, "状态", LVCFMT_CENTER, 50); m_GameRootItem.m_hCurrentItem = m_GameListTreeCtrl.InsertItem("游戏列表", NULL, NULL); m_GameListTreeCtrl.SetItemData(m_GameRootItem.m_hCurrentItem, LPARAM(&m_GameRootItem)); m_wSocket.m_hwnd = m_hWnd; m_BwSocket.m_hwnd = m_hWnd; m_LockDeskDlg.m_hWnd = m_hWnd; m_hBrush = CreateSolidBrush(RGB(255,255,255)); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
BOOL CWorkspaceDialog::OnInitDialog() { CString strCaption; strCaption.LoadString(GetTitleId()); if (!m_strName.IsEmpty()) strCaption += " " + m_strName; SetWindowText(strCaption); // Initialize the url prior to calling CDHtmlDialog::OnInitDialog() if (m_strCurrentUrl.IsEmpty()) m_strCurrentUrl = "about:blank"; CDHtmlDialog::OnInitDialog(); m_bUseHtmlTitle = false; // This magically makes the scroll bars appear and dis-allows text selection DWORD dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME | DOCHOSTUIFLAG_DIALOG; // DOCHOSTUIFLAG_NO3DOUTERBORDER; SetHostFlags(dwFlags); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. 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); } } // Set the icons for this dialog SetIcon(m_hIcon, true); // Set big icon SetIcon(m_hIcon, false); // Set small icon // Set the window size and position if (!m_pRect) CenterWindow(); else { CRect Rect = *m_pRect; SetWindowPos(NULL, Rect.left, Rect.top, Rect.Width(), Rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE); } // Copy this to CpDialog.cpp if (m_pBrowserApp) { m_pBrowserApp->put_RegisterAsDropTarget(VARIANT_FALSE); m_pBrowserApp->put_ToolBar(VARIANT_FALSE); m_pBrowserApp->put_StatusBar(VARIANT_TRUE); m_pBrowserApp->put_MenuBar(VARIANT_FALSE); m_pBrowserApp->put_Resizable(VARIANT_TRUE); m_pBrowserApp->put_AddressBar(VARIANT_FALSE); } Navigate(m_strUrl, navNoHistory/*dwFlags*/, "_self"/*lpszTargetFrameName*/, NULL/*lpszHeaders*/, NULL/*lpvPostData*/, 0/*dwPostDataLen*/); // Wait until the page is loaded if (m_pBrowserApp) { VARIANT_BOOL bBusy = true; // Initialize this to true if you want to wait for the document to load int i = 300; while (bBusy) { ::Sleep(100); m_pBrowserApp->get_Busy(&bBusy); if (--i <= 0) break; } } ShowWindow(SW_NORMAL); DragAcceptFiles(false); return true; // return TRUE unless you set the focus to a control }
static int RLXAPI CreateSurface(int numberOfSparePages) { static GLint attrib[32]; GLint *pAttrib = attrib; *pAttrib = AGL_RGBA; pAttrib++; *pAttrib = AGL_DOUBLEBUFFER; pAttrib++; *pAttrib = AGL_NONE; pAttrib++; AGLPixelFormat fmt; GLboolean ok; g_pRLX->pGX->View.lpBackBuffer = NULL; /* Choose an rgb pixel format */ GDHandle gdhDisplay; ok = DMGetGDeviceByDisplayID((DisplayIDType)g_cgDisplayID, &gdhDisplay, false); SYS_ASSERT(ok == noErr); fmt = aglChoosePixelFormat(&gdhDisplay, 1, attrib); SYS_AGLTRACE(0); if(fmt == NULL) { ok = SYS_AGLTRACE(aglGetError()); return -1; } /* Create an AGL context */ g_pAGLC = aglCreateContext(fmt, NULL); SYS_AGLTRACE(0); if(g_pAGLC == NULL) return -2; /* Attach the window to the context */ ok = SYS_AGLTRACE(aglSetDrawable(g_pAGLC, GetWindowPort(g_hWnd))); if(!ok) return -3; /* Make the context the current context */ ok = SYS_AGLTRACE(aglSetCurrentContext(g_pAGLC)); if(!ok) return -4; SizeWindow(g_hWnd, gl_lx, gl_ly, true); if ((g_pRLX->Video.Config & RLXVIDEO_Windowed)) CenterWindow(g_hWnd); ShowWindow(g_hWnd); // copy portRect GetPortBounds(GetWindowPort(g_hWnd), g_pRect); /* Pixel format is no more needed */ aglDestroyPixelFormat(fmt); if (!(g_pRLX->Video.Config & RLXVIDEO_Windowed)) { HideMenuBar(); aglSetFullScreen(g_pAGLC, 0, 0, 0, 0); GLint swap = !!(g_pRLX->pGX->View.Flags & GX_CAPS_VSYNC); aglSetInteger(g_pAGLC, AGL_SWAP_INTERVAL, &swap); SYS_AGLTRACE(0); } // Reset engine GL_InstallExtensions(); GL_ResetViewport(); g_pRLX->pGX->Surfaces.maxSurface = numberOfSparePages;; if (g_pRLX->pGX->View.Flags & GX_CAPS_MULTISAMPLING) { glEnable(GL_MULTISAMPLE_ARB); } return 0; }
INT_PTR CALLBACK ModifyDlgProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { static size_w len; HWND hwndHV = GetActiveHexView(g_hwndMain); static BOOL fHexLength = FALSE; static int nLastOperand = 0; static int nLastOperation = 0; static BOOL fBigEndian = FALSE; int basetype; static const int SearchTypeFromBaseType[] = { SEARCHTYPE_BYTE, SEARCHTYPE_WORD, SEARCHTYPE_DWORD, SEARCHTYPE_QWORD, SEARCHTYPE_BYTE, SEARCHTYPE_WORD, SEARCHTYPE_DWORD, SEARCHTYPE_QWORD, SEARCHTYPE_FLOAT, SEARCHTYPE_DOUBLE, }; switch (iMsg) { case WM_INITDIALOG: AddComboStringList(GetDlgItem(hwnd, IDC_MODIFY_DATATYPE), szTypeList, 0); AddComboStringList(GetDlgItem(hwnd, IDC_MODIFY_OPERATION), szOpList, nLastOperation); SetDlgItemBaseInt(hwnd, IDC_MODIFY_OPERAND, nLastOperand, fHexLength ? 16 : 10, FALSE); CheckDlgButton(hwnd, IDC_HEX, fHexLength ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_ENDIAN, fBigEndian ? BST_CHECKED : BST_UNCHECKED); //len = HexView_GetSelSize(hwndHV); //SetDlgItemBaseInt(hwnd, IDC_MODIFY_NUMBYTES, len, fHexLength ? 16 : 10, FALSE); CenterWindow(hwnd); return TRUE; case WM_CLOSE: EndDialog(hwnd, FALSE); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_MODIFY_OPERATION: case IDC_MODIFY_OPERAND: case IDC_MODIFY_NUMBYTES: nLastOperation = (int)SendDlgItemMessage(hwnd, IDC_MODIFY_OPERATION, CB_GETCURSEL, 0, 0); nLastOperand = (int)GetDlgItemBaseInt(hwnd, IDC_MODIFY_OPERAND, fHexLength ? 16 : 10); len = GetDlgItemBaseInt(hwnd, IDC_MODIFY_NUMBYTES, fHexLength ? 16 : 10); return TRUE; case IDC_ENDIAN: fBigEndian = IsDlgButtonChecked(hwnd, IDC_ENDIAN); return TRUE; case IDC_HEX: fHexLength = IsDlgButtonChecked(hwnd, IDC_HEX); /* len = HexView_GetSelSize(hwndHV); SetDlgItemBaseInt(hwnd, IDC_MODIFY_NUMBYTES, len, fHexLength ? 16 : 10, FALSE); */ SetDlgItemBaseInt(hwnd, IDC_MODIFY_OPERAND, nLastOperand, fHexLength ? 16 : 10, FALSE); SendDlgItemMessage(hwnd, IDC_MODIFY_OPERAND, EM_SETSEL, 0, -1); SetDlgItemFocus(hwnd, IDC_MODIFY_OPERAND); return TRUE; case IDOK: // get the basetype we are using basetype = (int)SendDlgItemMessage(hwnd, IDC_INSERT_DATATYPE, CB_GETCURSEL, 0, 0); basetype = SearchTypeFromBaseType[basetype]; // get the operand in raw-byte format, ensure it is always little-endian // as we must do these calculations using the native byte ordering format operandLen = sizeof(operandData); UpdateSearchData(GetDlgItem(hwnd, IDC_MODIFY_OPERAND), basetype, FALSE, operandData, &operandLen); HexView_GetSelSize(hwndHV, &len); ModifyHexViewData(hwndHV, nLastOperation, operandData, len, basetype, fBigEndian); EndDialog(hwnd, TRUE); return TRUE; case IDCANCEL: EndDialog(hwnd, FALSE); return TRUE; default: return FALSE; } case WM_HELP: return HandleContextHelp(hwnd, lParam, IDD_TRANSFORM); default: break; } return FALSE; }
BOOL CProgressWnd::Create(CWnd* pParent, LPCTSTR pszTitle, BOOL bSmooth /* = FALSE */) { BOOL bSuccess; m_strTitle = pszTitle; // Register window class CString csClassName = AfxRegisterWndClass(CS_OWNDC|CS_HREDRAW|CS_VREDRAW, ::LoadCursor(NULL, IDC_APPSTARTING), CBrush(::GetSysColor(COLOR_BTNFACE))); // Get the system window message font for use in the cancel button and text area NONCLIENTMETRICS ncm; ncm.cbSize = sizeof(NONCLIENTMETRICS); VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)); m_font.CreateFontIndirect(&(ncm.lfMessageFont)); // If no parent supplied then try and get a pointer to it anyway if (!pParent) pParent = AfxGetMainWnd(); // Create popup window //bSuccess = CreateEx(WS_EX_DLGMODALFRAME|WS_EX_TOPMOST, // Extended style bSuccess = CreateEx(WS_EX_DLGMODALFRAME, csClassName, // Classname pszTitle, // Title WS_POPUP|WS_BORDER|WS_CAPTION, // style 0,0, // position - updated soon. 390,130, // Size - updated soon pParent->GetSafeHwnd(), // handle to parent 0, // No menu NULL); if (!bSuccess) return FALSE; // Now create the controls CRect TempRect(0,0,10,10); bSuccess = m_Text.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_NOPREFIX|SS_LEFTNOWORDWRAP, TempRect, this, IDC_TEXT); if (!bSuccess) return FALSE; DWORD dwProgressStyle = WS_CHILD|WS_VISIBLE; #ifdef PBS_SMOOTH if (bSmooth) dwProgressStyle |= PBS_SMOOTH; #endif bSuccess = m_wndProgress.Create(dwProgressStyle,TempRect, this, IDC_PROGRESS); if (!bSuccess) return FALSE; bSuccess = m_CancelButton.Create(m_strCancelLabel, WS_CHILD|WS_VISIBLE|WS_TABSTOP| BS_PUSHBUTTON, TempRect, this, IDC_CANCEL); if (!bSuccess) return FALSE; m_CancelButton.SetFont(&m_font, TRUE); m_Text.SetFont(&m_font, TRUE); // Resize the whole thing according to the number of text lines, desired window // width and current font. SetWindowSize(m_nNumTextLines, 390); // Center and show window if (m_bPersistantPosition) GetPreviousSettings(); else CenterWindow(); Show(); return TRUE; }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // center the dialog on the screen CenterWindow(); // Set window icon SetIcon(::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)), 0); // Load heading icon HMODULE hExeModule = LoadLibrary(m_sImageName); if(hExeModule) { // Use IDR_MAINFRAME icon which is the default one for the crashed application. m_HeadingIcon = ::LoadIcon(hExeModule, MAKEINTRESOURCE(IDR_MAINFRAME)); } // If there is no IDR_MAINFRAME icon in crashed EXE module, use IDI_APPLICATION system icon if(m_HeadingIcon == NULL) { m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); } m_link.SubclassWindow(GetDlgItem(IDC_LINK)); m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO)); m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_statEmail = GetDlgItem(IDC_STATMAIL); m_editEmail = GetDlgItem(IDC_EMAIL); m_statDesc = GetDlgItem(IDC_DESCRIBE); m_editDesc = GetDlgItem(IDC_DESCRIPTION); m_statCrashRpt = GetDlgItem(IDC_CRASHRPT); m_statHorzLine = GetDlgItem(IDC_HORZLINE); m_btnOk = GetDlgItem(IDOK); m_btnCancel = GetDlgItem(IDCANCEL); CRect rc1, rc2; m_linkMoreInfo.GetWindowRect(&rc1); m_statHorzLine.GetWindowRect(&rc2); m_nDeltaY = rc1.bottom+15-rc2.top; LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 25; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); m_HeadingFont.CreateFontIndirect(&lf); ShowMoreInfo(FALSE); m_dlgProgress.Create(m_hWnd); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); return TRUE; }