In the cxxxapp: onfileopen () method of the app class, do not call cwinapp: onfileopen. Instead, call your own file selection box to obtain the file path and then call cwinapp: opendocumentfile to open the file.
As follows:
Void cmyprjeditdemoapp: onfileopen ()
{
// Todo: add your command handler code here
// The following is the self-added file opening dialog box
Cfiledialog DLG (true );
Int structsize = 0;
DWORD dwversion, dwwindowsmajorversion, dwwindowsminorversion;
Dwversion = getversion ();
Dwwindowsmajorversion = (DWORD) (lobyte (loword (dwversion )));
Dwwindowsminorversion = (DWORD) (hibyte (loword (dwversion )));
If (dwversion <0x80000000)
Structsize = 88;
Else
Structsize = 76;
//
Gisenv * Env = _ getenv ();
DLG. m_ofn.lpstrinitialdir = env-> cur;
DLG. m_ofn.lstructsize = structsize;
DLG. m_ofn.lpstrfilter = "project file (*. MPJ) \ 0 *. MPJ \ 0 all files (*. *) \ 0 *. * \ 0 \ 0 ";
If (idok = DLG. domodal ())
{
Cstring Path = DLG. getpathname ();
// Call cwinapp: opendocumentfile () to pass the path
Cwinapp: opendocumentfile (path. getbuffer (path. getlength ()));
}
}
Post: http://wwboss.blog.sohu.com/88957540.html