thank you for your reply. I found anoter function: CDocTemplate* pTemplate = pDocument->GetDocTemplate(); pTemplate->CloseAllDocuments(true);
though I don't know the progress of the function.
zeus_master
Posts
-
how to close all child windows in MDI? -
how to close all child windows in MDI?how to close all child windows in MDI? like the VC->windows->Close All command
-
close all child windows in MDIhow to close all child windows in MDI? like the VC->windows->Close All:^)
-
MessageBox Without any Button;Pcreate a dialog, and use time event......
-
CTreeCtrl questionthank you for your quick reply. about 2> in fact, I'v used SetItemData for manage the handle of MDI docs..... what I want is: aplly different doc template for different lay of item related Doc
-
CTreeCtrl questiona treectrl such as: [-]Root1 | |_Lay1Item1 | |_Lay1Item2 | [-]Lay1Item3 | |_Lay2Item1 | |_BB +Root2 1>.how to get the item handle by its name/string? 2>.how to know the item stay at which lay? for example: Lay1Item1 stay at lay 1, root is 0,BB is lay 2
-
MDI with VC6.0 workspace fileview like functionI set a treeview toolbar in my MDI project. just like the VC++ 6.0 workspace toolbar,Click the item/filename of the fileview, the related file opens and become active. and insert/delete item of the tree, it will new/close the related doc/file . 1.>how to create a new file for the new item ? 2.>when DbclickTree() happens, how to active the related file? 3.>does the files can searched/sort by filename as the treeview item sort? thanks for ur kind help!
-
newfile , new window in MDIhi,I need your help......
-
newfile , new window in MDIwhat's the difference between file->new and window->newwindow in MDI project(pj name mydoc)? why use file->new, the newfile name is mydoc1(or mydoc2,mydoc3,mydoc4.......) but window->new Window, the new doc name is mydoc1:2 (or mydoc1:3, mydoc1:4, mydoc2:2.......)?
-
New Dialog in a saved .exehave you add the #include "resource.h" in you application? in fact, these resource are defined in resource.h.
-
the MainFram & FormView in MDIDear VC-master, Thank you for your attention, In my MDI project, the based view is CFormView. named CMyView. the problem is, in CMainFrame class, SetValue()was defined. in CMyView class, public function SetEdit(true)was defined. in myview.cpp, if I use below, it is ok. void CMyView::OnSendValue() { CMainFrame *pMainfram = (CMainFrame *)AfxGetMainWnd(); pMainfram->SetValue(0x55); } but if In MainFrm.cpp void CMainFrame ::OnSendValue() { CMyView *pMyView= (CMyView *)GetActiveView(); pMyView->SetEdit(true); } it can build successfully, but failed execute. how to call the function/variable in active view?
-
Reading from Excelyou can find the CRecordset in the web... it can open the excel as database void CExDlg::OnRead() { // TODO: Add your control notification handler code here CDatabase database; CString sDriver; CString sDsn; CString sFile,sPath; //find the excel in main exe folder GetModuleFileName(NULL,sPath.GetBufferSetLength (MAX_PATH+1),MAX_PATH); sPath.ReleaseBuffer (); int nPos; nPos=sPath.ReverseFind ('\\'); sPath=sPath.Left (nPos); sFile = sPath + "\\Demo.xls"; //name of excel sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s", sDriver, sFile); TRY { database.Open(NULL, false, false, sDsn); CRecordset recset(&database); CString sSql; sSql = "SELECT item FROM Regt WHERE item = 'iwant' "; // // exe SQL recset.Open(CRecordset::forwardOnly, sSql, CRecordset::readOnly); BYTE line = 1; // »ñÈ¡²éѯ½á¹û while (!recset.IsEOF()) { //¶ÁÈ¡ExcelÄÚ²¿ÊýÖµ recset.GetFieldValue("item", sitem); // read out the item line++; //ÏÔʾ¼ÇÈ¡µÄÄÚÈÝ m_listbox.AddString( sitem); // ÒÆµ½ÏÂÒ»ÐÐ recset.MoveNext(); } // close database.Close(); } CATCH(CDBException, e) { // Êý¾Ý¿â²Ù×÷²úÉúÒ쳣ʱ... AfxMessageBox("error: " + e->m_strError); } END_CATCH; }
-
Enable edit control in Dialog access Enter and ESCI tried, and failed...... if there is no better methord,I would have to add the edit proc function in PreTranslateMessage() directly...
-
Enable edit control in Dialog access Enter and ESCyes the code below else is where I need your kindly help. if (!GetFocus()->IsKindOf(RUNTIME_CLASS(CEdit))) return true;// do nothing and ignore the key process else { ............... //add proper code for EDIT control capture the Enter and ESC key. }
-
Enable edit control in Dialog access Enter and ESCthank you for you suggestion, Ceric Moonen suggested me also. now the problem is how do single-line Edit control capture the Enter/Esc key.
-
Enable edit control in Dialog access Enter and ESCthen, how to handle the enter/esc key for Edit control and buttons? And seems that it doesn't enter into the OnChar() at all.
-
Enable edit control in Dialog access Enter and ESCGetFocus()->IsKindOf(RUNTIME_CLASS(CEdit)) is for checking current focus on Edit control or not. if it is not on edit control, will return and do nothing,if the focus is on edit control, then do what I want to.... -- modified at 4:35 Tuesday 20th June, 2006 By returning true from PreTranslateMessage(...), you are telling your application to bypass any default handling of the message. yes, or it will close the dialog
-
Enable edit control in Dialog access Enter and ESCMy edit controls are single-line. in fact, what I want is send a message to Parent window, when the focused edits/buttons get Enter/ESC key.
-
Enable edit control in Dialog access Enter and ESCSurely, the Dialog will close when the Enter and ESC key down. I know reload the PreTranslateMessage(MSG* pMsg) function can avoid the problem. In my project, there are some other controls in the dialog, and I want the Edit controls and buttons can get the Enter/ESC command but not close the Dialog, is there any way? I tried the OnChar(), OnCommad(), there din't work at all. BOOL CEditDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYDOWN) { if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE) { if (!GetFocus()->IsKindOf(RUNTIME_CLASS(CEdit))) return true;// pMsg->wParam=NULL ; else { ............... } } } return CDialog::PreTranslateMessage(pMsg); }
-
Memory setting for MFC projectit was impossible that my project would use over 10KB memory...... if I delete the debug folder, and rebuild the project, it seems ok, if I continue to add some class or variable for MFC controls, the error occurs again. some times the error is "Assert" some times is other.....