Click here to Skip to main content
15,921,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to get the date Pin
Jijo.Raj8-Jan-04 19:36
Jijo.Raj8-Jan-04 19:36 
GeneralAccessing all child windows from the main window Pin
Member 5343578-Jan-04 8:02
Member 5343578-Jan-04 8:02 
GeneralRe: Accessing all child windows from the main window Pin
Brian Shifrin8-Jan-04 10:14
Brian Shifrin8-Jan-04 10:14 
GeneralRe: Accessing all child windows from the main window Pin
SiddharthAtw8-Jan-04 17:37
SiddharthAtw8-Jan-04 17:37 
GeneralAttaching a standalone scrollbar to an edit control.. Pin
krbprogrammer8-Jan-04 7:37
krbprogrammer8-Jan-04 7:37 
GeneralTransparent Rectangle Pin
Anthony98878-Jan-04 6:56
Anthony98878-Jan-04 6:56 
GeneralRe: Transparent Rectangle Pin
Christian Graus8-Jan-04 9:10
protectorChristian Graus8-Jan-04 9:10 
GeneralSaving COleServerDoc Pin
kevcs28-Jan-04 6:56
kevcs28-Jan-04 6:56 
Hi all,

I have an MDI application. On selecting a menu item I open up a new document using CreateNewDocument(). But when I save the document, it shows illegal operation. I chose Full Server option for Step 3 of AppWizard, default file ext as ".d" in step 4 and CFormView as base class. My document is derived from COleServerDoc, by default. The code I tried for opening the document is below.

CTestView::OnMenuItem1()
{
CString s = ".d";
CTestApp* pApp = (CTestApp*)AfxGetApp();
CMultiDocTemplate* pDocTemplate = pApp->GetDocTemplate(s); //defined in CTestApp
if(!pDocTemplate)
return;
CTestDoc* pDoc = (CTestDoc*)pDocTemplate->CreateNewDocument();
pDocTemplate->SetDefaultTitle(pDoc);
CFrameWnd* pFrame = pDocTemplate->CreateNewFrame(pDoc,NULL);
pDocTemplate->InitialUpdateFrame(pFrame,pDoc,TRUE);
}

CMultiDocTemplate* CTestApp::GetDocTemplate(CString& sType)
{
CMultiDocTemplate* pDocTemplate;
POSITION pos = GetFirstDoctemplate();
while(pos)
{
pDocTemplate = (CMultiDoctemplate*)GetNextDocTemplate(pos);
CString ext;
if(pDocTemplate->GetDocString(ext,CDocTemplate::filterExt))
{
if(ext == sType)
return pDocTemplate;
}
}
return 0;
}

Why am I not able to save this document? The same code works well for MDI applications with CSrollView and CFormView base class and None option for Step 3 of AppWizard.

regards
kevcs2

GeneralTerminating an application. Pin
Prakash Nadar8-Jan-04 6:47
Prakash Nadar8-Jan-04 6:47 
GeneralRe: Terminating an application. Pin
Dominik Reichl8-Jan-04 7:48
Dominik Reichl8-Jan-04 7:48 
GeneralHebrew and WS_EX_RTLREADING Pin
LukeV8-Jan-04 6:09
LukeV8-Jan-04 6:09 
GeneralRe: Hebrew and WS_EX_RTLREADING Pin
mryazdani8-Jan-04 12:11
mryazdani8-Jan-04 12:11 
GeneralNeed help with Visual Studio Pin
RedDragon2k8-Jan-04 6:07
RedDragon2k8-Jan-04 6:07 
GeneralRe: Need help with Visual Studio Pin
Computer Technology Student8-Jan-04 6:16
sussComputer Technology Student8-Jan-04 6:16 
GeneralRe: Need help with Visual Studio Pin
John R. Shaw8-Jan-04 7:41
John R. Shaw8-Jan-04 7:41 
QuestionHow to detect a CEdit control scrollbar position.. Pin
krbprogrammer8-Jan-04 5:46
krbprogrammer8-Jan-04 5:46 
AnswerRe: How to detect a CEdit control scrollbar position.. Pin
Jörgen Sigvardsson8-Jan-04 8:10
Jörgen Sigvardsson8-Jan-04 8:10 
GeneralRe: How to detect a CEdit control scrollbar position.. Pin
krbprogrammer8-Jan-04 8:37
krbprogrammer8-Jan-04 8:37 
GeneralInstallShield Pin
act_x8-Jan-04 5:44
act_x8-Jan-04 5:44 
GeneralRe: InstallShield Pin
shultas8-Jan-04 11:38
shultas8-Jan-04 11:38 
GeneralRe: InstallShield Pin
LukeV9-Jan-04 4:55
LukeV9-Jan-04 4:55 
GeneralRe: InstallShield Pin
mryazdani8-Jan-04 11:48
mryazdani8-Jan-04 11:48 
Questionhow can a tiff file be read? Pin
evangedhivya8-Jan-04 5:35
evangedhivya8-Jan-04 5:35 
AnswerRe: how can a tiff file be read? Pin
John R. Shaw8-Jan-04 6:26
John R. Shaw8-Jan-04 6:26 
GeneralAccess file information cannot display in List Box Pin
ansontong8-Jan-04 4:45
ansontong8-Jan-04 4:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.