Click here to Skip to main content
15,914,070 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Updating Controls Pin
Christian Graus16-May-01 12:26
protectorChristian Graus16-May-01 12:26 
GeneralSetFocus question Pin
16-May-01 6:22
suss16-May-01 6:22 
GeneralRe: SetFocus question Pin
Michael Dunn16-May-01 16:27
sitebuilderMichael Dunn16-May-01 16:27 
GeneralDelete a tab in a Tab Control Pin
16-May-01 6:04
suss16-May-01 6:04 
GeneralRe: Delete a tab in a Tab Control Pin
Tomasz Sowinski16-May-01 8:25
Tomasz Sowinski16-May-01 8:25 
QuestionPassive (PASV) FTP-Mode with MFC's Internet classes? Pin
Uwe Keim16-May-01 6:02
sitebuilderUwe Keim16-May-01 6:02 
GeneralOpenDocument problem Pin
16-May-01 5:00
suss16-May-01 5:00 
GeneralRe: OpenDocument problem Pin
Christian Graus16-May-01 12:36
protectorChristian Graus16-May-01 12:36 
Hmmm.... you're using serialisation ? I admit I never do, I handle loading and saving myself. In my code, the App class OnFileOpen handler looks like this:

char BASED_CODE szFilter[] = "Bitmap (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg|Png (*.png)|*.png|Tiff (*.tiff)|*.tif|Targa (*.tga)|*.tga|Windows Metafile (*.wmf)|*.wmf|All (*.*)|*.*|\0";
CFileOpenDlg dlg(true, "bmp", NULL, OFN_FILEMUSTEXIST, szFilter);
if (m_szLoadPath.GetLength() > 2)
dlg.m_ofn.lpstrInitialDir = m_szLoadPath;
if (dlg.DoModal() == IDOK)
{
m_szLoadPath = dlg.GetPathName();
int pos = m_szLoadPath.ReverseFind('\\');
m_szLoadPath = m_szLoadPath.Left(pos + 1);
AfxGetApp()->OpenDocumentFile(dlg.GetPathName());
}

and then in OpenDocumentFile in my document class, I just go into a series of if/else's to figure out the extension and then load the file accordingly. I don't know how you'd handle it for serialisation, sorry.

I also do this in my doc class OnFileOpen:

CGrausPaintApp * pApp = (CGrausPaintApp*)AfxGetApp();
pApp->OnFileOpen();


because I found the first call goes to the app class, once you have a doc open, the doc class is called. I'd guess you need to do something similar to set things up, but then call Serialise to load. If you've done that, the problem is probably in the Serializing code, and I haven't done that stuff since 1999.

Christian

I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.

The early bird may get the worm, but it's the second mouse that gets the cheese.
GeneralRe: OpenDocument problem Pin
17-May-01 8:17
suss17-May-01 8:17 
GeneralEasy one,,,(this is quick) Pin
mr200316-May-01 4:49
mr200316-May-01 4:49 
GeneralRe: Easy one,,,(this is quick) Pin
Christian Graus16-May-01 12:29
protectorChristian Graus16-May-01 12:29 
GeneralDLL Memory Issues Pin
16-May-01 3:50
suss16-May-01 3:50 
GeneralRe: DLL Memory Issues Pin
Tomasz Sowinski16-May-01 4:07
Tomasz Sowinski16-May-01 4:07 
GeneralLinks in a Chatwindow Pin
Klymer16-May-01 3:46
Klymer16-May-01 3:46 
GeneralRe: Links in a Chatwindow Pin
Tomasz Sowinski16-May-01 4:09
Tomasz Sowinski16-May-01 4:09 
GeneralRe: Links in a Chatwindow Pin
Klymer16-May-01 4:25
Klymer16-May-01 4:25 
GeneralCWinApp::SelectPrinter() ASSERTs Pin
Neville Franks16-May-01 3:45
Neville Franks16-May-01 3:45 
GeneralRe: CWinApp::SelectPrinter() ASSERTs Pin
Tomasz Sowinski16-May-01 3:57
Tomasz Sowinski16-May-01 3:57 
GeneralUnable to initialize DAO/Jet db engine error on clean win98 system Pin
Rob Bechamp16-May-01 3:29
Rob Bechamp16-May-01 3:29 
GeneralRe: Unable to initialize DAO/Jet db engine error on clean win98 system Pin
Tomasz Sowinski16-May-01 3:49
Tomasz Sowinski16-May-01 3:49 
GeneralRe: Unable to initialize DAO/Jet db engine error on clean win98 system Pin
Rob Bechamp16-May-01 4:30
Rob Bechamp16-May-01 4:30 
GeneralRe: Unable to initialize DAO/Jet db engine error on clean win98 system Pin
16-May-01 4:40
suss16-May-01 4:40 
GeneralRe: Unable to initialize DAO/Jet db engine error on clean win98 system Pin
Tomasz Sowinski16-May-01 4:42
Tomasz Sowinski16-May-01 4:42 
GeneralRe: Unable to initialize DAO/Jet db engine error on clean win98 system Pin
Rob Bechamp16-May-01 5:17
Rob Bechamp16-May-01 5:17 
GeneralSystem Specs Pin
16-May-01 3:20
suss16-May-01 3:20 

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.