BOOL CCpDialog::OnInitDialog() { CString strAppRootFolder = GetHomeFolder() + String(GetFolderId()); CString strContentRootFolder; CRegKey regkey; if (regkey.Open(HKEY_CURRENT_USER, REGKEY_APP) == ERROR_SUCCESS) { ULONG nLen = 255; char* pszValue = new char[nLen+1]; *pszValue = 0; nLen = 256; if (regkey.QueryStringValue(REGVAL_CONTENT_FOLDER, pszValue, &nLen) == ERROR_SUCCESS) { pszValue[nLen] = 0; strContentRootFolder = CString(pszValue); } delete [] pszValue; } if (strContentRootFolder.IsEmpty()) strContentRootFolder = GetHomeFolder() + String(IDS_CONTENT_FOLDER); DWORD dwCount = CheckForUiUpdates(strAppRootFolder); CheckForNewContent(strContentRootFolder, strAppRootFolder, (dwCount > 0)/*bForceCreate*/); // Update the variables.xsl and linelist.xml files SaveAppVariablesFile(strContentRootFolder, strAppRootFolder); SaveContentVariablesFile(strContentRootFolder, strAppRootFolder); CString strCaption; strCaption.LoadString(GetTitleId()); SetWindowText(strCaption); // Initialize the url prior to calling CDHtmlDialog::OnInitDialog() if (m_strCurrentUrl.IsEmpty()) m_strCurrentUrl = "about:blank"; CDHtmlDialog::OnInitDialog(); // 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 CRect rect; rect.SetRect(0, 0, 800, 600); if (0) // Restore the saved window size and position { DWORD dwSize = sizeof(rect); regkey.QueryBinaryValue(REGVAL_LOCATION, &rect, &dwSize); //j Someday, clip the rect to the display SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE); } else { SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE); CenterWindow(); } CString strHomePage = strAppRootFolder + String(IDS_HOME_PAGE); if (FileExists(strHomePage)) Navigate(strHomePage); ShowWindow(SW_NORMAL); DragAcceptFiles(false); return true; // return TRUE unless you set the focus to a control }
BOOL CDlgImage::OnInitDialog() { CDHtmlDialog::OnInitDialog(); SetHostFlags(DOCHOSTUIFLAG_NO3DBORDER|DOCHOSTUIFLAG_DIALOG|DOCHOSTUIFLAG_FLAT_SCROLLBAR); // m_isInit = true; // DisplayScrollInfo(); return TRUE; // return TRUE unless you set the focus to a control }
CMiniMule::CMiniMule(CWnd* pParent /*=NULL*/) : CDHtmlDialog(CMiniMule::IDD, CMiniMule::IDH, pParent) { m_iInCallback = 0; m_bResolveImages = true; m_bRestoreMainWnd = false; m_uAutoCloseTimer = 0; m_bAutoClose = theApp.GetProfileInt(_T("eMule"), _T("MiniMuleAutoClose"), 0)!=0; m_uWndTransparency = theApp.GetProfileInt(_T("eMule"), _T("MiniMuleTransparency"), 0); SetHostFlags(m_dwHostFlags | DOCHOSTUIFLAG_DIALOG // MSHTML does not enable selection of the text in the form | DOCHOSTUIFLAG_DISABLE_HELP_MENU // MSHTML does not add the Help menu item to the container's menu. ); }
BOOL HtmlDlg::OnInitDialog() { CDHtmlDialog::OnInitDialog(); //m_pBrowserApp->put_Top(0); //m_pBrowserApp->put_Left(0); //m_pBrowserApp->put_Height(200); //m_pBrowserApp->put_Width(300); m_wndBrowser.MoveWindow(0,0,600,350); //设置html的显示区域 SetHostFlags(DOCHOSTUIFLAG_NO3DBORDER/*DOCHOSTUIFLAG_DIALOG*/); //增加滚动条 return TRUE; // 除非将焦点设置到控件,否则返回 TRUE }
BOOL SkinDownload::OnInitDialog() { CDHtmlDialog::OnInitDialog(); SetHostFlags(DOCHOSTUIFLAG_THEME | DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DIALOG | DOCHOSTUIFLAG_ENABLE_ACTIVEX_INACTIVATE_MODE | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE | DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY ); CString strResourceURL; LPTSTR lpszModule = new TCHAR[_MAX_PATH]; if (GetModuleFileName(NULL, lpszModule, _MAX_PATH)) { // load resource html regardless by language strResourceURL.Format(_T("res://%s/%d"), lpszModule, IDR_HTML_BUSY); Navigate(strResourceURL, 0, 0, 0); } else Navigate(L"about:blank"); return TRUE; }
BOOL OnInitDialog() { SetHostFlags(DOCHOSTUIFLAG_NO3DBORDER); CDHtmlDialog::OnInitDialog(); return TRUE; }
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 }