|
in the OnNewDocument in your Doc class, return FALSE and that is it
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Thanx for the response.
But if i set OnNewDocument to FALSE then i cant create new windows using file new option.isnt it?..Even if i set this to FALSE, at run time can i later set it TRUE sO that i can click New to launch MDI CHild windows later..
Thank you. .
|
|
|
|
|
Thanx for the response.
But if i set OnNewDocument to FALSE then further i cant create new windows using file new option.isn't it?..Even if i set this to FALSE, at run time can i later set this option as TRUE so that i can click New to launch MDI CHild windows later..
Thank you. .
laiju
|
|
|
|
|
In your app's InitInstance() function you will see the line
ParseCommandLine(cmdInfo) Immediately after that line you have to check the value of cmdInfo.m_nShellCommand . If it is CCommandLineInfo::FileNew then the ProcessShellCommand(cmdInfo); line will open a new document. What you have to do is change the value of m_nShellCommand to CCommandLineInfo::FileNothing .
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
return FALSE;
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
What I understand from ur suggestion is that I need to check
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNothing)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNew
So if its FileNothing I have to set FileNew as shown above. Is this what u are saying.?
If so how can I access the application?s InitInstance method after the application is loaded ..Can I set these values in some other methods may be in MainFrame in click events or some thing like that.
laiju
|
|
|
|
|
Right now I have an deskband that supports MFC. I have a button on the band that I want to create a CPropertySheet type config dialog. I used classes derived from CPropetyPage and CPropertySheet that I already had working, but the I always get a debug assertion error when creating the pages, or when I call DoModal. I thought maybe it was my classes, but I get the same problem with using the standard MFC classes. The debug assertions come from these lines:
VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));<br />
AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);
Those lines are present in the constructor for CPropertyPage, and DoModal in CPropertySheet. Any ideas? Thanks!
|
|
|
|
|
I dynamically load a Dll in my Doc,it can access the variables of Doc,but not the functions,and get two errors.
CfgCom.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CMainDoc::MSCommSet(void)" (?MSCommSet@CMainDoc@@QAE_NXZ)
..\..\Bin/Cfg_Com.dll : fatal error LNK1120: 1 unresolved externals
Thanks for any help!
|
|
|
|
|
I suspect you should link your program with "your.lib" (assuming you want to use your.dll). Normally, "your.lib" is created after building "your.dll" and contains references to exported functions.
|
|
|
|
|
???,I don't use mydll.lib.
I use "AfxLoadLibrary" to dynamically load mydll.dll,and use "GetProcAddress" to call the exported functions.it works.
now ,i want mydll.dll to call public functions of doc.like "CMainDoc::MSCommSet(void)"
in fact i export a CView from this dll.
|
|
|
|
|
How To Draw Outside Window Context
|
|
|
|
|
|
char *ptr = new char[10];
memcpy(ptr,"Balkrishna",10);
//strcpy(ptr,"Balkrishna");
ptr[10]='\0';
AfxMessageBox(ptr);
delete ptr; // why does this crashes, ANy soultion??
--------------------------------------------------------
on contrary
char *ptr = new char[10];
memcpy(ptr,"Balkrishna",10);
//strcpy(ptr,"Balkrishna");
//ptr[10]='\0'; if i comment it works, but with garbage, WHY
AfxMessageBox(ptr);
delete ptr; //WONT CRASH HERE
|
|
|
|
|
"Balkrishna" contains in fact 11 characters !!!
Don't forget the trailling '\0' that "closes" your C-Style string.
So, by doing strcpy() you make an overflow and write in a memory space that is not yours...
to prevent such crash, declare char ptr[11] (or more)...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Dear TOXCCT,
Balkrishna is 10 character, BTW even if i take 9 char and 10th is null, still it will crash.....
|
|
|
|
|
Balkrishna is 10 characters, but i said "Balkrishna", that equals to {'B', 'a', 'l', 'k', 'r', 'i', 's', 'h', 'n', 'a', '\0'} .
however, i don't know more, but maybe you could help me a bit more by copying the error message, and also the context if necessary...
oops, Mr DavidCrow's right, i didn't see
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Balkrishna Talele wrote:
ptr[10]='\0';
You don't have "permission" to access the 11th byte of this memory location.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
O o... Thanks,...a lot
cheers
Balkrishna
|
|
|
|
|
By the way,
incorrect deletion of pointer to an array,
use
delete[] ptr;
instead of
delete ptr;
|
|
|
|
|
You're seeing a failed assert, not a crash. The assert message will say something like "damage after normal block" which means you wrote past the end of the memory block you allocated (in this case, you allocated 10 bytes but wrote to 11).
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I HAVE USED
setAttribute(bstrAttributeName, varValue)
TO APPEND ATTRIBUTE NAME AND VALUE.BUT IT IS A MEMBER OF IXMLDOMELEMENT SO THE ATTRIBUTE IS APPEDED IN THE ROOT TAG .HOW TO APPEND ATTRIBUTE IN OTHER TAGS
|
|
|
|
|
|
|
|
Ah! I was slightly ashamed of being rude... but I could not resist!
|
|
|
|
|